telegrinder 0.1.dev158__py3-none-any.whl → 0.1.dev159__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.

@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import typing
2
4
 
3
5
  from fntypes.co import Option, Result, Some, Variative
@@ -6,23 +8,46 @@ from telegrinder.api import ABCAPI, APIError
6
8
  from telegrinder.model import get_params
7
9
  from telegrinder.msgspec_utils import Nothing
8
10
  from telegrinder.types import (
11
+ ChatAction,
12
+ DiceEmoji,
9
13
  ForceReply,
10
14
  InlineKeyboardMarkup,
15
+ InputFile,
16
+ InputMedia,
17
+ LabeledPrice,
18
+ LinkPreviewOptions,
11
19
  Message,
12
20
  MessageEntity,
21
+ MessageId,
22
+ ReactionEmoji,
13
23
  ReactionType,
14
- ReactionTypeEmoji,
15
- ReactionTypeType,
16
24
  ReplyKeyboardMarkup,
17
25
  ReplyKeyboardRemove,
18
26
  ReplyParameters,
19
27
  User,
20
28
  )
21
- from telegrinder.types.objects import InputFile
22
29
 
23
- from .base import BaseCute
30
+ from .base import BaseCute, compose_method_params, shortcut
31
+ from .utils import (
32
+ compose_link_preview_options,
33
+ compose_reactions,
34
+ compose_reply_params,
35
+ input_media,
36
+ )
37
+
38
+ if typing.TYPE_CHECKING:
39
+ from datetime import datetime
40
+
41
+ from .callback_query import CallbackQueryCute
24
42
 
25
- ReplyMarkup = typing.Union[
43
+ MediaType: typing.TypeAlias = typing.Literal[
44
+ "animation",
45
+ "audio",
46
+ "document",
47
+ "photo",
48
+ "video",
49
+ ]
50
+ ReplyMarkup: typing.TypeAlias = typing.Union[
26
51
  InlineKeyboardMarkup,
27
52
  ReplyKeyboardMarkup,
28
53
  ReplyKeyboardRemove,
@@ -30,12 +55,89 @@ ReplyMarkup = typing.Union[
30
55
  ]
31
56
 
32
57
 
58
+ async def execute_method_answer(
59
+ message: MessageCute,
60
+ method_name: str,
61
+ params: dict[str, typing.Any],
62
+ ) -> Result[typing.Any, APIError]:
63
+ params = compose_method_params(
64
+ params=params,
65
+ update=message,
66
+ default_params={"chat_id", "message_thread_id"},
67
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
68
+ )
69
+ reply_parameters = params.get("reply_parameters")
70
+ link_preview_options = params.get("link_preview_options")
71
+
72
+ if reply_parameters is not None and isinstance(reply_parameters, dict):
73
+ reply_parameters.setdefault(
74
+ "message_id", params.get("message_id", message.message_id)
75
+ )
76
+ reply_parameters.setdefault("chat_id", params.get("chat_id"))
77
+ params["reply_parameters"] = compose_reply_params(**reply_parameters)
78
+
79
+ if link_preview_options is not None and isinstance(link_preview_options, dict):
80
+ params["link_preview_options"] = compose_link_preview_options(**link_preview_options)
81
+
82
+ result = await getattr(message.ctx_api, method_name)(**params)
83
+ return result.map(
84
+ lambda x: x if isinstance(x, bool)
85
+ else MessageCute.from_update(x, bound_api=message.api)
86
+ if not isinstance(x, list)
87
+ else [MessageCute.from_update(m, bound_api=message.api) for m in x]
88
+ )
89
+
90
+
91
+ async def execute_method_reply(
92
+ message: MessageCute,
93
+ method_name: str,
94
+ params: dict[str, typing.Any],
95
+ ) -> Result[typing.Any, APIError]:
96
+ params.setdefault("reply_params", {})
97
+ return await execute_method_answer(message, method_name, params)
98
+
99
+
100
+ async def execute_method_edit(
101
+ update: MessageCute | CallbackQueryCute,
102
+ method_name: str,
103
+ params: dict[str, typing.Any],
104
+ ) -> Result[typing.Any, APIError]:
105
+ params = compose_method_params(
106
+ params=params,
107
+ update=update,
108
+ default_params={"chat_id", "message_id", "message_thread_id", "inline_message_id"},
109
+ validators={
110
+ "inline_message_id": lambda x: not x.message_id,
111
+ "message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)
112
+ if isinstance(x, MessageCute) else bool(x.message) and getattr(
113
+ x.message.unwrap().v, "is_topic_message", False
114
+ ),
115
+ },
116
+ )
117
+ if "inline_message_id" in params:
118
+ params.pop("message_id", None)
119
+ params.pop("chat_id", None)
120
+ result = await getattr(update.ctx_api, method_name)(**params)
121
+ return result.map(
122
+ lambda v: Variative[MessageCute, bool](
123
+ v.only().map(
124
+ lambda x: MessageCute.from_update(x, bound_api=update.api),
125
+ ).unwrap_or(typing.cast(bool, v.v))
126
+ )
127
+ )
128
+
129
+
33
130
  def get_entity_value(
34
- entities: list[MessageEntity], entity_value: str
131
+ entity_value: typing.Literal["user", "url", "custom_emoji_id", "language"],
132
+ entities: Option[list[MessageEntity]] = Nothing,
133
+ caption_entities: Option[list[MessageEntity]] = Nothing,
35
134
  ) -> Option[typing.Any]:
36
- for entity in entities:
37
- if (obj := getattr(entity, entity_value, Nothing)):
38
- return Some(obj.value if isinstance(obj, Some) else obj)
135
+ ents = entities.unwrap_or(caption_entities.unwrap_or_none())
136
+ if not ents:
137
+ return Nothing
138
+ for entity in ents:
139
+ if (obj := getattr(entity, entity_value, Nothing)) is not Nothing:
140
+ return obj if isinstance(obj, Some) else Some(obj)
39
141
  return Nothing
40
142
 
41
143
 
@@ -46,148 +148,2858 @@ class MessageCute(BaseCute[Message], Message, kw_only=True):
46
148
  def mentioned_user(self) -> Option[User]:
47
149
  """Mentioned user without username."""
48
150
 
49
- if not self.entities:
50
- return Nothing
51
- return get_entity_value(self.entities.unwrap(), "user")
151
+ return get_entity_value("user", self.entities, self.caption_entities)
52
152
 
53
153
  @property
54
154
  def url(self) -> Option[str]:
55
155
  """Clickable text URL."""
56
156
 
57
- if not self.entities:
58
- return Nothing
59
- return get_entity_value(self.entities.unwrap(), "url")
157
+ return get_entity_value("url", self.entities, self.caption_entities)
60
158
 
61
159
  @property
62
160
  def programming_language(self) -> Option[str]:
63
161
  """The programming language of the entity text."""
64
162
 
65
- if not self.entities:
66
- return Nothing
67
- return get_entity_value(self.entities.unwrap(), "language")
163
+ return get_entity_value("language", self.entities, self.caption_entities)
68
164
 
69
165
  @property
70
166
  def custom_emoji_id(self) -> Option[str]:
71
167
  """Unique identifier of the custom emoji."""
72
168
 
73
- if not self.entities:
74
- return Nothing
75
- return get_entity_value(self.entities.unwrap(), "custom_emoji_id")
169
+ return get_entity_value("custom_emoji_id", self.entities, self.caption_entities)
76
170
 
171
+ @shortcut(
172
+ "send_message",
173
+ executor=execute_method_answer,
174
+ custom_params={"link_preview_options", "reply_parameters", "message_thread_id"},
175
+ )
77
176
  async def answer(
78
177
  self,
79
- text: str | Option[str],
178
+ text: str | Option[str] = Nothing,
179
+ chat_id: int | str | Option[int | str] = Nothing,
180
+ message_thread_id: int | Option[int] = Nothing,
80
181
  parse_mode: str | Option[str] = Nothing,
81
182
  entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
82
- disable_web_page_preview: bool | Option[bool] = Nothing,
83
183
  disable_notification: bool | Option[bool] = Nothing,
84
184
  protect_content: bool | Option[bool] = Nothing,
85
- reply_to_message_id: int | Option[int] = Nothing,
86
- allow_sending_without_reply: bool | Option[bool] = Nothing,
87
- reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
88
- **other: typing.Any,
89
- ) -> Result["Message", APIError]:
90
- params = get_params(locals())
91
- if "message_thread_id" not in params and self.is_topic_message:
92
- params["message_thread_id"] = self.message_thread_id
93
- return await self.ctx_api.send_message(chat_id=self.chat.id, **params)
94
-
95
- async def answer_file(
96
- self,
97
- file: str | InputFile,
98
- caption: str | Option[str] = Nothing,
99
- parse_mode: str | Option[str] = Nothing,
100
- thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
101
- caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
102
- disable_content_type_detection: Option[bool] | bool = Nothing,
103
- disable_notification: Option[bool] | bool = Nothing,
104
- protect_content: bool | Option[bool] = Nothing,
105
- reply_parameters: Option[ReplyParameters] | ReplyParameters = Nothing,
185
+ link_preview_options: Option[LinkPreviewOptions | dict[str, typing.Any]]
186
+ | LinkPreviewOptions
187
+ | dict[str, typing.Any] = Nothing,
188
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
189
+ | ReplyParameters
190
+ | dict[str, typing.Any] = Nothing,
106
191
  reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
107
192
  **other: typing.Any,
108
- ) -> Result[Message, APIError]:
109
- params = get_params(locals())
110
- if "message_thread_id" not in params and self.is_topic_message:
111
- params["message_thread_id"] = self.message_thread_id
112
- return await self.ctx_api.send_document(
113
- chat_id=self.chat.id,
114
- document=file,
115
- **params,
116
- )
193
+ ) -> Result[MessageCute, APIError]:
194
+ """Shortcut `API.send_message()`, see the [documentation](https://core.telegram.org/bots/api#sendmessage)
195
+
196
+ Use this method to send a message with text messages. On success, the sent Message is returned.
117
197
 
198
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
199
+ (in the format @channelusername).
200
+
201
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
202
+ forum supergroups only.
203
+
204
+ :param text: Text of the message to be sent, 1-4096 characters after entities parsing. \
205
+
206
+ :param parse_mode: Mode for parsing entities in the message text. See formatting options for \
207
+ more details.
208
+
209
+ :param entities: A JSON-serialized list of special entities that appear in message text, \
210
+ which can be specified instead of parse_mode.
211
+
212
+ :param link_preview_options: Link preview generation options for the message.
213
+
214
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
215
+
216
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
217
+
218
+ :param reply_parameters: Description of the message to reply to.
219
+
220
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
221
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
222
+ or to force a reply from the user."""
223
+
224
+ ...
225
+
226
+ @shortcut(
227
+ "send_message",
228
+ executor=execute_method_reply,
229
+ custom_params={"reply_parameters", "message_thread_id"},
230
+ )
118
231
  async def reply(
119
232
  self,
120
- text: str | Option[str],
233
+ text: str | Option[str] = Nothing,
234
+ chat_id: int | str | Option[int | str] = Nothing,
235
+ message_id: int | Option[int] = Nothing,
236
+ message_thread_id: int | Option[int] = Nothing,
121
237
  parse_mode: str | Option[str] = Nothing,
122
238
  entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
123
- disable_web_page_preview: bool | Option[bool] = Nothing,
124
239
  disable_notification: bool | Option[bool] = Nothing,
125
240
  protect_content: bool | Option[bool] = Nothing,
126
- allow_sending_without_reply: bool | Option[bool] = Nothing,
241
+ link_preview_options: Option[LinkPreviewOptions | dict[str, typing.Any]]
242
+ | LinkPreviewOptions
243
+ | dict[str, typing.Any] = Nothing,
244
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
245
+ | ReplyParameters
246
+ | dict[str, typing.Any] = Nothing,
127
247
  reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
128
248
  **other: typing.Any,
129
- ) -> Result["Message", APIError]:
130
- params = get_params(locals())
131
- if "message_thread_id" not in params and self.is_topic_message:
132
- params["message_thread_id"] = self.message_thread_id
133
- return await self.ctx_api.send_message(
134
- chat_id=self.chat.id,
135
- reply_to_message_id=self.message_id,
136
- **params,
137
- )
249
+ ) -> Result[MessageCute, APIError]:
250
+ """Shortcut `API.send_message()`, see the [documentation](https://core.telegram.org/bots/api#sendmessage)
138
251
 
139
- async def delete(self, **other: typing.Any) -> Result[bool, APIError]:
140
- params = get_params(locals())
141
- if "message_thread_id" not in params and self.is_topic_message:
142
- params["message_thread_id"] = self.message_thread_id
143
- return await self.ctx_api.delete_message(
144
- chat_id=self.chat.id,
145
- message_id=self.message_id,
146
- **params,
252
+ Use this method to send a reply to a message with text messages. On success, the sent Message is returned.
253
+
254
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
255
+ (in the format @channelusername).
256
+
257
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
258
+ forum supergroups only.
259
+
260
+ :param text: Text of the message to be sent, 1-4096 characters after entities parsing. \
261
+
262
+ :param parse_mode: Mode for parsing entities in the message text. See formatting options for \
263
+ more details.
264
+
265
+ :param entities: A JSON-serialized list of special entities that appear in message text, \
266
+ which can be specified instead of parse_mode.
267
+
268
+ :param link_preview_options: Link preview generation options for the message.
269
+
270
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
271
+
272
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
273
+
274
+ :param reply_parameters: Description of the message to reply to.
275
+
276
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
277
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
278
+ or to force a reply from the user."""
279
+
280
+ ...
281
+
282
+ @shortcut("delete_message", custom_params={"message_thread_id"})
283
+ async def delete(
284
+ self,
285
+ chat_id: int | Option[int] = Nothing,
286
+ message_id: int | Option[int] = Nothing,
287
+ message_thread_id: int | Option[int] = Nothing,
288
+ **other: typing.Any,
289
+ ) -> Result[bool, APIError]:
290
+ """Shortcut `API.delete_message()`, see the [documentation](https://core.telegram.org/bots/api#deletemessage)
291
+
292
+ Use this method to delete a message, including service messages, with the
293
+ following limitations: - A message can only be deleted if it was sent less
294
+ than 48 hours ago. - Service messages about a supergroup, channel, or forum
295
+ topic creation can't be deleted. - A dice message in a private chat can only
296
+ be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing
297
+ messages in private chats, groups, and supergroups. - Bots can delete incoming
298
+ messages in private chats. - Bots granted can_post_messages permissions
299
+ can delete outgoing messages in channels. - If the bot is an administrator
300
+ of a group, it can delete any message there. - If the bot has can_delete_messages
301
+ permission in a supergroup or a channel, it can delete any message there.
302
+ Returns True on success.
303
+
304
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
305
+ (in the format @channelusername).
306
+
307
+ :param message_id: Identifier of the message to delete.
308
+
309
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
310
+ forum supergroups only."""
311
+
312
+ params = compose_method_params(
313
+ params=get_params(locals()),
314
+ update=self,
315
+ default_params={"chat_id", "message_id", "message_thread_id"},
316
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
147
317
  )
318
+ return await self.ctx_api.delete_message(**params)
148
319
 
320
+ @shortcut(
321
+ "edit_message_text",
322
+ executor=execute_method_edit,
323
+ custom_params={"link_preview_options", "message_thread_id"},
324
+ )
149
325
  async def edit(
150
326
  self,
151
327
  text: str | Option[str] = Nothing,
328
+ chat_id: int | Option[int] = Nothing,
329
+ message_id: int | Option[int] = Nothing,
330
+ message_thread_id: int | Option[int] = Nothing,
152
331
  parse_mode: str | Option[str] = Nothing,
153
332
  entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
154
- disable_web_page_preview: bool | Option[bool] = Nothing,
155
- reply_markup: InlineKeyboardMarkup
156
- | Option[InlineKeyboardMarkup] = Nothing,
333
+ link_preview_options: Option[LinkPreviewOptions | dict[str, typing.Any]]
334
+ | LinkPreviewOptions
335
+ | dict[str, typing.Any] = Nothing,
336
+ reply_markup: InlineKeyboardMarkup | Option[InlineKeyboardMarkup] = Nothing,
157
337
  **other: typing.Any,
158
- ) -> Result[Variative[Message, bool], APIError]:
159
- params = get_params(locals())
160
- if "message_thread_id" not in params and self.is_topic_message:
161
- params["message_thread_id"] = self.message_thread_id
162
- return await self.ctx_api.edit_message_text(
163
- chat_id=self.chat.id,
164
- message_id=self.message_id,
165
- **params,
338
+ ) -> Result[Variative[MessageCute, bool], APIError]:
339
+ """Shortcut `API.edit_message_text()`, see the [documentation](https://core.telegram.org/bots/api#editmessagetext)
340
+
341
+ Use this method to edit text and game messages. On success, if the edited
342
+ message is not an inline message, the edited Message is returned, otherwise
343
+ True is returned.
344
+
345
+ :param chat_id: Required if inline_message_id is not specified. Unique identifier for \
346
+ the target chat or username of the target channel (in the format @channelusername). \
347
+
348
+ :param message_id: Required if inline_message_id is not specified. Identifier of the message \
349
+ to edit.
350
+
351
+ :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the \
352
+ inline message.
353
+
354
+ :param text: New text of the message, 1-4096 characters after entities parsing.
355
+
356
+ :param parse_mode: Mode for parsing entities in the message text. See formatting options for \
357
+ more details.
358
+
359
+ :param entities: A JSON-serialized list of special entities that appear in message text, \
360
+ which can be specified instead of parse_mode.
361
+
362
+ :param link_preview_options: Link preview generation options for the message.
363
+
364
+ :param reply_markup: A JSON-serialized object for an inline keyboard."""
365
+
366
+ ...
367
+
368
+ @shortcut(
369
+ "copy_message",
370
+ custom_params={"reply_parameters", "message_thread_id"},
371
+ )
372
+ async def copy(
373
+ self,
374
+ chat_id: int | str | Option[int | str] = Nothing,
375
+ from_chat_id: int | str | Option[int | str] = Nothing,
376
+ message_id: int | Option[int] = Nothing,
377
+ message_thread_id: Option[int] | int = Nothing,
378
+ caption: Option[str] | str = Nothing,
379
+ parse_mode: Option[str] | str = Nothing,
380
+ caption_entities: Option[list[MessageEntity]] | list[MessageEntity] = Nothing,
381
+ disable_notification: Option[bool] | bool = Nothing,
382
+ protect_content: Option[bool] | bool = Nothing,
383
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
384
+ | ReplyParameters
385
+ | dict[str, typing.Any] = Nothing,
386
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
387
+ **other: typing.Any,
388
+ ) -> Result[MessageId, APIError]:
389
+ """Shortcut `API.copy_message()`, see the [documentation](https://core.telegram.org/bots/api#copymessage)
390
+
391
+ Use this method to copy messages of any kind. Service messages, giveaway
392
+ messages, giveaway winners messages, and invoice messages can't be copied.
393
+ A quiz poll can be copied only if the value of the field correct_option_id
394
+ is known to the bot. The method is analogous to the method forwardMessage,
395
+ but the copied message doesn't have a link to the original message. Returns
396
+ the MessageId of the sent message on success.
397
+
398
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
399
+ (in the format @channelusername).
400
+
401
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
402
+ forum supergroups only.
403
+
404
+ :param from_chat_id: Unique identifier for the chat where the original message was sent (or channel \
405
+ username in the format @channelusername).
406
+
407
+ :param message_id: Message identifier in the chat specified in from_chat_id.
408
+
409
+ :param caption: New caption for media, 0-1024 characters after entities parsing. If not \
410
+ specified, the original caption is kept.
411
+
412
+ :param parse_mode: Mode for parsing entities in the new caption. See formatting options for \
413
+ more details.
414
+
415
+ :param caption_entities: A JSON-serialized list of special entities that appear in the new caption, \
416
+ which can be specified instead of parse_mode.
417
+
418
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
419
+
420
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
421
+
422
+ :param reply_parameters: Description of the message to reply to.
423
+
424
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
425
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
426
+ or to force a reply from the user.
427
+ """
428
+
429
+ params = compose_method_params(
430
+ params=get_params(locals()),
431
+ update=self,
432
+ default_params={
433
+ "chat_id",
434
+ "message_id",
435
+ ("from_chat_id", "chat_id"),
436
+ "message_thread_id",
437
+ },
438
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
166
439
  )
167
-
440
+ if isinstance(reply_parameters, dict):
441
+ reply_parameters.setdefault("message_id", params.get("message_id"))
442
+ reply_parameters.setdefault("chat_id", params.get("chat_id"))
443
+ params["reply_parameters"] = compose_reply_params(**reply_parameters)
444
+ return await self.ctx_api.copy_message(**params)
445
+
446
+ @shortcut(
447
+ "set_message_reaction",
448
+ custom_params={"message_thread_id"},
449
+ )
168
450
  async def react(
169
451
  self,
170
- reaction: str | ReactionType
171
- | list[str | ReactionType]
172
- | Option[list[str | ReactionType]] = Nothing,
452
+ reaction: str
453
+ | ReactionEmoji
454
+ | ReactionType
455
+ | list[str | ReactionEmoji | ReactionType]
456
+ | Option[
457
+ str
458
+ | ReactionEmoji
459
+ | ReactionType
460
+ | list[str | ReactionEmoji | ReactionType]
461
+ ] = Nothing,
462
+ chat_id: int | str | Option[int | str] = Nothing,
463
+ message_thread_id: Option[int] | int = Nothing,
464
+ message_id: int | Option[int] = Nothing,
173
465
  is_big: bool | Option[bool] = Nothing,
174
466
  **other: typing.Any,
175
467
  ) -> Result[bool, APIError]:
468
+ """Shortcut `API.set_message_reaction()`, see the [documentation](https://core.telegram.org/bots/api#setmessagereaction)
469
+
470
+ Use this method to change the chosen reactions on a message. Service messages
471
+ can't be reacted to. Automatically forwarded messages from a channel to
472
+ its discussion group have the same available reactions as messages in the
473
+ channel. Returns True on success.
474
+
475
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
476
+ (in the format @channelusername).
477
+
478
+ :param message_id: Identifier of the target message. If the message belongs to a media group, \
479
+ the reaction is set to the first non-deleted message in the group instead. \
480
+
481
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
482
+ forum supergroups only.
483
+
484
+ :param reaction: New list of reaction types to set on the message. Currently, as non-premium \
485
+ users, bots can set up to one reaction per message. A custom emoji reaction \
486
+ can be used if it is either already present on the message or explicitly allowed \
487
+ by chat administrators.
488
+
489
+ :param is_big: Pass True to set the reaction with a big animation.
490
+ """
491
+
492
+ params = compose_method_params(
493
+ params=get_params(locals()),
494
+ update=self,
495
+ default_params={"chat_id", "message_id", "message_thread_id"},
496
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
497
+ )
176
498
  if reaction:
177
- reaction = [
178
- ReactionTypeEmoji(ReactionTypeType.EMOJI, r)
179
- if isinstance(r, str)
180
- else r
181
- for r in (
182
- reaction.unwrap_or([]) if isinstance(reaction, Some | type(Nothing))
183
- else [reaction] if not isinstance(reaction, list) else reaction
184
- )
185
- ]
186
- return await self.ctx_api.set_message_reaction(
187
- chat_id=self.chat.id,
188
- message_id=self.message_id,
189
- **get_params(locals())
499
+ params["reaction"] = compose_reactions(
500
+ reaction.unwrap() if isinstance(reaction, Some) else reaction,
501
+ )
502
+ return await self.ctx_api.set_message_reaction(**params)
503
+
504
+ @shortcut("forward_message", custom_params={"message_thread_id"})
505
+ async def forward(
506
+ self,
507
+ chat_id: int | str,
508
+ message_id: int | Option[int] = Nothing,
509
+ from_chat_id: int | str | Option[int | str] = Nothing,
510
+ message_thread_id: int | Option[int] = Nothing,
511
+ disable_notification: bool | Option[bool] = Nothing,
512
+ protect_content: bool | Option[bool] = Nothing,
513
+ **other: typing.Any,
514
+ ) -> Result[MessageCute, APIError]:
515
+ """Shortcut `API.forward_message()`, see the [documentation](https://core.telegram.org/bots/api#forwardmessage)
516
+
517
+ Use this method to forward messages of any kind. Service messages and messages
518
+ with protected content can't be forwarded. On success, the sent Message
519
+ is returned.
520
+
521
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
522
+ (in the format @channelusername).
523
+
524
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
525
+ forum supergroups only.
526
+
527
+ :param from_chat_id: Unique identifier for the chat where the original message was sent (or channel \
528
+ username in the format @channelusername).
529
+
530
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
531
+
532
+ :param protect_content: Protects the contents of the forwarded message from forwarding and saving. \
533
+
534
+ :param message_id: Message identifier in the chat specified in from_chat_id."""
535
+
536
+ params = compose_method_params(
537
+ params=get_params(locals()),
538
+ update=self,
539
+ default_params={("from_chat_id", "chat_id"), "message_id", "message_thread_id"},
540
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
541
+ )
542
+ return (await self.ctx_api.forward_message(**params)).map(
543
+ lambda message: MessageCute.from_update(message, bound_api=self.api),
544
+ )
545
+
546
+ @shortcut("pin_chat_message", custom_params={"message_thread_id"})
547
+ async def pin(
548
+ self,
549
+ chat_id: Option[int | str] | int | str = Nothing,
550
+ message_id: Option[int] | int = Nothing,
551
+ message_thread_id: Option[int] | int = Nothing,
552
+ disable_notification: bool | Option[bool] = Nothing,
553
+ **other: typing.Any,
554
+ ) -> Result[bool, "APIError"]:
555
+ """Shortcut `API.pin_chat_message()`, see the [documentation](https://core.telegram.org/bots/api#pinchatmessage)
556
+
557
+ Use this method to add a message to the list of pinned messages in a chat. If
558
+ the chat is not a private chat, the bot must be an administrator in the chat
559
+ for this to work and must have the 'can_pin_messages' administrator right
560
+ in a supergroup or 'can_edit_messages' administrator right in a channel.
561
+ Returns True on success.
562
+
563
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
564
+ (in the format @channelusername).
565
+
566
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
567
+ forum supergroups only.
568
+
569
+ :param message_id: Identifier of a message to pin.
570
+
571
+ :param disable_notification: Pass True if it is not necessary to send a notification to all chat members \
572
+ about the new pinned message. Notifications are always disabled in channels \
573
+ and private chats.
574
+ """
575
+
576
+ params = compose_method_params(
577
+ params=get_params(locals()),
578
+ update=self,
579
+ default_params={"chat_id", "message_id", "message_thread_id"},
580
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
581
+ )
582
+ return await self.ctx_api.pin_chat_message(**params)
583
+
584
+ @shortcut("unpin_chat_message", custom_params={"message_thread_id"})
585
+ async def unpin(
586
+ self,
587
+ chat_id: Option[int | str] | int | str = Nothing,
588
+ message_id: Option[int] | int = Nothing,
589
+ message_thread_id: Option[int] | int = Nothing,
590
+ **other: typing.Any,
591
+ ) -> Result[bool, "APIError"]:
592
+ """Shortcut `API.unpin_chat_message()`, see the [documentation](https://core.telegram.org/bots/api#unpinchatmessage)
593
+
594
+ Use this method to remove a message from the list of pinned messages in a chat.
595
+ If the chat is not a private chat, the bot must be an administrator in the chat
596
+ for this to work and must have the 'can_pin_messages' administrator right
597
+ in a supergroup or 'can_edit_messages' administrator right in a channel.
598
+ Returns True on success.
599
+
600
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
601
+ (in the format @channelusername).
602
+
603
+ :param message_id: Identifier of a message to unpin. If not specified, the most recent pinned \
604
+ message (by sending date) will be unpinned.
605
+ """
606
+
607
+ params = compose_method_params(
608
+ params=get_params(locals()),
609
+ update=self,
610
+ default_params={"chat_id", "message_id", "message_thread_id"},
611
+ validators={"message_thread_id": lambda x: x.is_topic_message.unwrap_or(False)},
190
612
  )
613
+ return await self.ctx_api.pin_chat_message(**params)
614
+
615
+ @shortcut(
616
+ "send_audio",
617
+ executor=execute_method_answer,
618
+ custom_params={"reply_parameters", "message_thread_id"},
619
+ )
620
+ async def answer_audio(
621
+ self,
622
+ audio: str | InputFile,
623
+ chat_id: int | str | Option[int | str] = Nothing,
624
+ message_thread_id: int | Option[int] = Nothing,
625
+ caption: str | Option[str] = Nothing,
626
+ parse_mode: str | Option[str] = Nothing,
627
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
628
+ duration: int | Option[int] = Nothing,
629
+ performer: str | Option[str] = Nothing,
630
+ title: str | Option[str] = Nothing,
631
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
632
+ disable_notification: Option[bool] | bool = Nothing,
633
+ protect_content: bool | Option[bool] = Nothing,
634
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
635
+ | ReplyParameters
636
+ | dict[str, typing.Any] = Nothing,
637
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
638
+ **other: typing.Any,
639
+ ) -> Result[MessageCute, APIError]:
640
+ """Shortcut `API.send_audio()`, see the [documentation](https://core.telegram.org/bots/api#sendaudio)
641
+
642
+ Use this method to send audio files, if you want Telegram clients to display
643
+ them in the music player. Your audio must be in the .MP3 or .M4A format. On
644
+ success, the sent Message is returned. Bots can currently send audio files
645
+ of up to 50 MB in size, this limit may be changed in the future. For sending
646
+ voice messages, use the sendVoice method instead.
647
+
648
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
649
+ (in the format @channelusername).
650
+
651
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
652
+ forum supergroups only.
653
+
654
+ :param audio: Audio file to send. Pass a file_id as String to send an audio file that exists \
655
+ on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
656
+ to get an audio file from the Internet, or upload a new one using multipart/form-data. \
657
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
658
+
659
+ :param caption: Audio caption, 0-1024 characters after entities parsing.
660
+
661
+ :param parse_mode: Mode for parsing entities in the audio caption. See formatting options \
662
+ for more details.
663
+
664
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
665
+ which can be specified instead of parse_mode.
666
+
667
+ :param duration: Duration of the audio in seconds.
668
+
669
+ :param performer: Performer.
670
+
671
+ :param title: Track name.
672
+
673
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
674
+ file is supported server-side. The thumbnail should be in JPEG format and \
675
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
676
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
677
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
678
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
679
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
680
+
681
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
682
+
683
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
684
+
685
+ :param reply_parameters: Description of the message to reply to.
686
+
687
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
688
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
689
+ or to force a reply from the user."""
690
+
691
+ ...
692
+
693
+ @shortcut(
694
+ "send_animation",
695
+ executor=execute_method_answer,
696
+ custom_params={"reply_parameters", "message_thread_id"},
697
+ )
698
+ async def answer_animation(
699
+ self,
700
+ animation: str | InputFile,
701
+ chat_id: int | str | Option[int | str] = Nothing,
702
+ message_thread_id: int | Option[int] = Nothing,
703
+ caption: str | Option[str] = Nothing,
704
+ parse_mode: str | Option[str] = Nothing,
705
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
706
+ duration: int | Option[int] = Nothing,
707
+ width: int | Option[int] = Nothing,
708
+ height: int | Option[int] = Nothing,
709
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
710
+ has_spoiler: bool | Option[bool] = Nothing,
711
+ disable_notification: Option[bool] | bool = Nothing,
712
+ protect_content: bool | Option[bool] = Nothing,
713
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
714
+ | ReplyParameters
715
+ | dict[str, typing.Any] = Nothing,
716
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
717
+ **other: typing.Any,
718
+ ) -> Result[MessageCute, APIError]:
719
+ """Shortcut `API.send_animation()`, see the [documentation](https://core.telegram.org/bots/api#sendanimation)
720
+
721
+ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without
722
+ sound). On success, the sent Message is returned. Bots can currently send
723
+ animation files of up to 50 MB in size, this limit may be changed in the future.
724
+
725
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
726
+ (in the format @channelusername).
727
+
728
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
729
+ forum supergroups only.
730
+
731
+ :param animation: Animation to send. Pass a file_id as String to send an animation that exists \
732
+ on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
733
+ to get an animation from the Internet, or upload a new animation using multipart/form-data. \
734
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
735
+
736
+ :param duration: Duration of sent animation in seconds.
737
+
738
+ :param width: Animation width.
739
+
740
+ :param height: Animation height.
741
+
742
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
743
+ file is supported server-side. The thumbnail should be in JPEG format and \
744
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
745
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
746
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
747
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
748
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
749
+
750
+ :param caption: Animation caption (may also be used when resending animation by file_id), \
751
+ 0-1024 characters after entities parsing.
752
+
753
+ :param parse_mode: Mode for parsing entities in the animation caption. See formatting options \
754
+ for more details.
755
+
756
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
757
+ which can be specified instead of parse_mode.
758
+
759
+ :param has_spoiler: Pass True if the animation needs to be covered with a spoiler animation. \
760
+
761
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
762
+
763
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
764
+
765
+ :param reply_parameters: Description of the message to reply to.
766
+
767
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
768
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
769
+ or to force a reply from the user."""
770
+
771
+ ...
772
+
773
+ @shortcut(
774
+ "send_document",
775
+ executor=execute_method_answer,
776
+ custom_params={"reply_parameters", "message_thread_id"},
777
+ )
778
+ async def answer_document(
779
+ self,
780
+ document: str | InputFile,
781
+ chat_id: int | str | Option[int | str] = Nothing,
782
+ message_thread_id: int | Option[int] = Nothing,
783
+ caption: str | Option[str] = Nothing,
784
+ parse_mode: str | Option[str] = Nothing,
785
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
786
+ disable_content_type_detection: Option[bool] | bool = Nothing,
787
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
788
+ disable_notification: Option[bool] | bool = Nothing,
789
+ protect_content: bool | Option[bool] = Nothing,
790
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
791
+ | ReplyParameters
792
+ | dict[str, typing.Any] = Nothing,
793
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
794
+ **other: typing.Any,
795
+ ) -> Result[MessageCute, APIError]:
796
+ """Shortcut `API.send_document()`, see the [documentation](https://core.telegram.org/bots/api#senddocument)
797
+
798
+ Use this method to send general files. On success, the sent Message is returned.
799
+ Bots can currently send files of any type of up to 50 MB in size, this limit
800
+ may be changed in the future.
801
+
802
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
803
+ (in the format @channelusername).
804
+
805
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
806
+ forum supergroups only.
807
+
808
+ :param document: File to send. Pass a file_id as String to send a file that exists on the Telegram \
809
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
810
+ file from the Internet, or upload a new one using multipart/form-data. \
811
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
812
+
813
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
814
+ file is supported server-side. The thumbnail should be in JPEG format and \
815
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
816
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
817
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
818
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
819
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
820
+
821
+ :param caption: Document caption (may also be used when resending documents by file_id), \
822
+ 0-1024 characters after entities parsing.
823
+
824
+ :param parse_mode: Mode for parsing entities in the document caption. See formatting options \
825
+ for more details.
826
+
827
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
828
+ which can be specified instead of parse_mode.
829
+
830
+ :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded \
831
+ using multipart/form-data.
832
+
833
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
834
+
835
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
836
+
837
+ :param reply_parameters: Description of the message to reply to.
838
+
839
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
840
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
841
+ or to force a reply from the user."""
842
+
843
+ ...
844
+
845
+ @shortcut(
846
+ "send_photo",
847
+ executor=execute_method_answer,
848
+ custom_params={"reply_parameters", "message_thread_id"},
849
+ )
850
+ async def answer_photo(
851
+ self,
852
+ photo: str | InputFile,
853
+ chat_id: int | str | Option[int | str] = Nothing,
854
+ message_thread_id: int | Option[int] = Nothing,
855
+ caption: str | Option[str] = Nothing,
856
+ parse_mode: str | Option[str] = Nothing,
857
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
858
+ has_spoiler: bool | Option[bool] = Nothing,
859
+ disable_notification: Option[bool] | bool = Nothing,
860
+ protect_content: bool | Option[bool] = Nothing,
861
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
862
+ | ReplyParameters
863
+ | dict[str, typing.Any] = Nothing,
864
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
865
+ **other: typing.Any,
866
+ ) -> Result[MessageCute, APIError]:
867
+ """Shortcut `API.send_photo()`, see the [documentation](https://core.telegram.org/bots/api#sendphoto)
868
+
869
+ Use this method to send photos. On success, the sent Message is returned.
870
+
871
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
872
+ (in the format @channelusername).
873
+
874
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
875
+ forum supergroups only.
876
+
877
+ :param photo: Photo to send. Pass a file_id as String to send a photo that exists on the Telegram \
878
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
879
+ photo from the Internet, or upload a new photo using multipart/form-data. \
880
+ The photo must be at most 10 MB in size. The photo's width and height must not \
881
+ exceed 10000 in total. Width and height ratio must be at most 20. More information \
882
+ on Sending Files: https://core.telegram.org/bots/api#sending-files. \
883
+
884
+ :param caption: Photo caption (may also be used when resending photos by file_id), 0-1024 \
885
+ characters after entities parsing.
886
+
887
+ :param parse_mode: Mode for parsing entities in the photo caption. See formatting options \
888
+ for more details.
889
+
890
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
891
+ which can be specified instead of parse_mode.
892
+
893
+ :param has_spoiler: Pass True if the photo needs to be covered with a spoiler animation.
894
+
895
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
896
+
897
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
898
+
899
+ :param reply_parameters: Description of the message to reply to.
900
+
901
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
902
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
903
+ or to force a reply from the user."""
904
+
905
+ ...
906
+
907
+ @shortcut(
908
+ "send_sticker",
909
+ executor=execute_method_answer,
910
+ custom_params={"reply_parameters", "message_thread_id"},
911
+ )
912
+ async def answer_sticker(
913
+ self,
914
+ sticker: str | InputFile,
915
+ chat_id: int | str | Option[int | str] = Nothing,
916
+ emoji: str | Option[str] = Nothing,
917
+ message_thread_id: int | Option[int] = Nothing,
918
+ disable_notification: Option[bool] | bool = Nothing,
919
+ protect_content: bool | Option[bool] = Nothing,
920
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
921
+ | ReplyParameters
922
+ | dict[str, typing.Any] = Nothing,
923
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
924
+ **other: typing.Any,
925
+ ) -> Result[MessageCute, APIError]:
926
+ """Shortcut `API.send_sticker()`, see the [documentation](https://core.telegram.org/bots/api#sendsticker)
927
+
928
+ Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
929
+ On success, the sent Message is returned.
930
+
931
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
932
+ (in the format @channelusername).
933
+
934
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
935
+ forum supergroups only.
936
+
937
+ :param sticker: Sticker to send. Pass a file_id as String to send a file that exists on the \
938
+ Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
939
+ to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker \
940
+ using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
941
+ Video stickers can only be sent by a file_id. Animated stickers can't be \
942
+ sent via an HTTP URL.
943
+
944
+ :param emoji: Emoji associated with the sticker; only for just uploaded stickers.
945
+
946
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
947
+
948
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
949
+
950
+ :param reply_parameters: Description of the message to reply to.
951
+
952
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
953
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
954
+ or to force a reply from the user."""
955
+
956
+ ...
957
+
958
+ @shortcut(
959
+ "send_video",
960
+ executor=execute_method_answer,
961
+ custom_params={"reply_parameters", "message_thread_id"},
962
+ )
963
+ async def answer_video(
964
+ self,
965
+ video: str | InputFile,
966
+ chat_id: int | str | Option[int | str] = Nothing,
967
+ message_thread_id: int | Option[int] = Nothing,
968
+ caption: str | Option[str] = Nothing,
969
+ parse_mode: str | Option[str] = Nothing,
970
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
971
+ duration: int | Option[int] = Nothing,
972
+ width: int | Option[int] = Nothing,
973
+ height: int | Option[int] = Nothing,
974
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
975
+ has_spoiler: bool | Option[bool] = Nothing,
976
+ supports_streaming: bool | Option[bool] = Nothing,
977
+ disable_notification: Option[bool] | bool = Nothing,
978
+ protect_content: bool | Option[bool] = Nothing,
979
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
980
+ | ReplyParameters
981
+ | dict[str, typing.Any] = Nothing,
982
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
983
+ **other: typing.Any,
984
+ ) -> Result[MessageCute, APIError]:
985
+ """Shortcut `API.send_video()`, see the [documentation](https://core.telegram.org/bots/api#sendvideo)
986
+
987
+ Use this method to send video files, Telegram clients support MPEG4 videos
988
+ (other formats may be sent as Document). On success, the sent Message is
989
+ returned. Bots can currently send video files of up to 50 MB in size, this
990
+ limit may be changed in the future.
991
+
992
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
993
+ (in the format @channelusername).
994
+
995
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
996
+ forum supergroups only.
997
+
998
+ :param video: Video to send. Pass a file_id as String to send a video that exists on the Telegram \
999
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
1000
+ video from the Internet, or upload a new video using multipart/form-data. \
1001
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1002
+
1003
+ :param duration: Duration of sent video in seconds.
1004
+
1005
+ :param width: Video width.
1006
+
1007
+ :param height: Video height.
1008
+
1009
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
1010
+ file is supported server-side. The thumbnail should be in JPEG format and \
1011
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
1012
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
1013
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
1014
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
1015
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1016
+
1017
+ :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 \
1018
+ characters after entities parsing.
1019
+
1020
+ :param parse_mode: Mode for parsing entities in the video caption. See formatting options \
1021
+ for more details.
1022
+
1023
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1024
+ which can be specified instead of parse_mode.
1025
+
1026
+ :param has_spoiler: Pass True if the video needs to be covered with a spoiler animation.
1027
+
1028
+ :param supports_streaming: Pass True if the uploaded video is suitable for streaming.
1029
+
1030
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1031
+
1032
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1033
+
1034
+ :param reply_parameters: Description of the message to reply to.
1035
+
1036
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1037
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1038
+ or to force a reply from the user."""
1039
+
1040
+ ...
1041
+
1042
+ @shortcut(
1043
+ "send_video_note",
1044
+ executor=execute_method_answer,
1045
+ custom_params={"reply_parameters", "message_thread_id"},
1046
+ )
1047
+ async def answer_video_note(
1048
+ self,
1049
+ video_note: str | InputFile,
1050
+ chat_id: int | str | Option[int | str] = Nothing,
1051
+ duration: int | Option[int] = Nothing,
1052
+ length: int | Option[int] = Nothing,
1053
+ message_thread_id: int | Option[int] = Nothing,
1054
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
1055
+ disable_notification: Option[bool] | bool = Nothing,
1056
+ protect_content: bool | Option[bool] = Nothing,
1057
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1058
+ | ReplyParameters
1059
+ | dict[str, typing.Any] = Nothing,
1060
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1061
+ **other: typing.Any,
1062
+ ) -> Result[MessageCute, APIError]:
1063
+ """Shortcut `API.send_video_note()`, see the [documentation](https://core.telegram.org/bots/api#sendvideonote)
1064
+
1065
+ As of v.4.0, Telegram clients support rounded square MPEG4 videos of up
1066
+ to 1 minute long. Use this method to send video messages. On success, the
1067
+ sent Message is returned.
1068
+
1069
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1070
+ (in the format @channelusername).
1071
+
1072
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1073
+ forum supergroups only.
1074
+
1075
+ :param video_note: Video note to send. Pass a file_id as String to send a video note that exists \
1076
+ on the Telegram servers (recommended) or upload a new video using multipart/form-data. \
1077
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1078
+ Sending video notes by a URL is currently unsupported.
1079
+
1080
+ :param duration: Duration of sent video in seconds.
1081
+
1082
+ :param length: Video width and height, i.e. diameter of the video message.
1083
+
1084
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
1085
+ file is supported server-side. The thumbnail should be in JPEG format and \
1086
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
1087
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
1088
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
1089
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
1090
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1091
+
1092
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1093
+
1094
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1095
+
1096
+ :param reply_parameters: Description of the message to reply to.
1097
+
1098
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1099
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1100
+ or to force a reply from the user."""
1101
+
1102
+ ...
1103
+
1104
+ @shortcut(
1105
+ "send_voice",
1106
+ executor=execute_method_answer,
1107
+ custom_params={"reply_parameters", "message_thread_id"},
1108
+ )
1109
+ async def answer_voice(
1110
+ self,
1111
+ voice: str | InputFile,
1112
+ chat_id: int | str | Option[int | str] = Nothing,
1113
+ message_thread_id: int | Option[int] = Nothing,
1114
+ caption: str | Option[str] = Nothing,
1115
+ parse_mode: str | Option[str] = Nothing,
1116
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1117
+ duration: int | Option[int] = Nothing,
1118
+ disable_notification: Option[bool] | bool = Nothing,
1119
+ protect_content: bool | Option[bool] = Nothing,
1120
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1121
+ | ReplyParameters
1122
+ | dict[str, typing.Any] = Nothing,
1123
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1124
+ **other: typing.Any,
1125
+ ) -> Result[MessageCute, APIError]:
1126
+ """Shortcut `API.send_voice()`, see the [documentation](https://core.telegram.org/bots/api#sendvoice)
1127
+
1128
+ Use this method to send audio files, if you want Telegram clients to display
1129
+ the file as a playable voice message. For this to work, your audio must be
1130
+ in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
1131
+ On success, the sent Message is returned. Bots can currently send voice
1132
+ messages of up to 50 MB in size, this limit may be changed in the future.
1133
+
1134
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1135
+ (in the format @channelusername).
1136
+
1137
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1138
+ forum supergroups only.
1139
+
1140
+ :param voice: Audio file to send. Pass a file_id as String to send a file that exists on the \
1141
+ Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
1142
+ to get a file from the Internet, or upload a new one using multipart/form-data. \
1143
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1144
+
1145
+ :param caption: Voice message caption, 0-1024 characters after entities parsing.
1146
+
1147
+ :param parse_mode: Mode for parsing entities in the voice message caption. See formatting \
1148
+ options for more details.
1149
+
1150
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1151
+ which can be specified instead of parse_mode.
1152
+
1153
+ :param duration: Duration of the voice message in seconds.
1154
+
1155
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1156
+
1157
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1158
+
1159
+ :param reply_parameters: Description of the message to reply to.
1160
+
1161
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1162
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1163
+ or to force a reply from the user."""
1164
+
1165
+ ...
1166
+
1167
+ @shortcut(
1168
+ "send_poll",
1169
+ executor=execute_method_answer,
1170
+ custom_params={"reply_parameters", "message_thread_id"},
1171
+ )
1172
+ async def answer_poll(
1173
+ self,
1174
+ question: str,
1175
+ options: list[str],
1176
+ chat_id: int | str | Option[int | str] = Nothing,
1177
+ message_thread_id: Option[int] | int = Nothing,
1178
+ is_anonymous: Option[bool] | bool = Nothing,
1179
+ type: Option[typing.Literal["quiz", "regular"]]
1180
+ | typing.Literal["quiz", "regular"] = Nothing,
1181
+ allows_multiple_answers: Option[bool] | bool = Nothing,
1182
+ correct_option_id: Option[int] | int = Nothing,
1183
+ explanation: Option[str] | str = Nothing,
1184
+ explanation_parse_mode: Option[str] | str = Nothing,
1185
+ explanation_entities: Option[list[MessageEntity]]
1186
+ | list[MessageEntity] = Nothing,
1187
+ open_period: Option[int] | int = Nothing,
1188
+ close_date: Option[datetime | int] | datetime | int = Nothing,
1189
+ is_closed: Option[bool] | bool = Nothing,
1190
+ disable_notification: Option[bool] | bool = Nothing,
1191
+ protect_content: Option[bool] | bool = Nothing,
1192
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1193
+ | ReplyParameters
1194
+ | dict[str, typing.Any] = Nothing,
1195
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1196
+ **other: typing.Any,
1197
+ ) -> Result[MessageCute, APIError]:
1198
+ """Shortcut `API.send_poll()`, see the [documentation](https://core.telegram.org/bots/api#sendpoll)
1199
+
1200
+ Use this method to send a native poll. On success, the sent Message is returned.
1201
+
1202
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1203
+ (in the format @channelusername).
1204
+
1205
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1206
+ forum supergroups only.
1207
+
1208
+ :param question: Poll question, 1-300 characters.
1209
+
1210
+ :param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters \
1211
+ each.
1212
+
1213
+ :param is_anonymous: True, if the poll needs to be anonymous, defaults to True.
1214
+
1215
+ :param type: Poll type, `quiz` or `regular`, defaults to `regular`.
1216
+
1217
+ :param allows_multiple_answers: True, if the poll allows multiple answers, ignored for polls in quiz mode, \
1218
+ defaults to False.
1219
+
1220
+ :param correct_option_id: 0-based identifier of the correct answer option, required for polls in \
1221
+ quiz mode.
1222
+
1223
+ :param explanation: Text that is shown when a user chooses an incorrect answer or taps on the lamp \
1224
+ icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after \
1225
+ entities parsing.
1226
+
1227
+ :param explanation_parse_mode: Mode for parsing entities in the explanation. See formatting options for \
1228
+ more details.
1229
+
1230
+ :param explanation_entities: A JSON-serialized list of special entities that appear in the poll explanation, \
1231
+ which can be specified instead of parse_mode.
1232
+
1233
+ :param open_period: Amount of time in seconds the poll will be active after creation, 5-600. \
1234
+ Can't be used together with close_date.
1235
+
1236
+ :param close_date: Point in time (Unix timestamp) when the poll will be automatically closed. \
1237
+ Must be at least 5 and no more than 600 seconds in the future. Can't be used \
1238
+ together with open_period.
1239
+
1240
+ :param is_closed: Pass True if the poll needs to be immediately closed. This can be useful for \
1241
+ poll preview.
1242
+
1243
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1244
+
1245
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1246
+
1247
+ :param reply_parameters: Description of the message to reply to.
1248
+
1249
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1250
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1251
+ or to force a reply from the user."""
1252
+
1253
+ ...
1254
+
1255
+ @shortcut(
1256
+ "send_venue",
1257
+ executor=execute_method_answer,
1258
+ custom_params={"reply_parameters", "message_thread_id"},
1259
+ )
1260
+ async def answer_venue(
1261
+ self,
1262
+ latitude: float,
1263
+ longitude: float,
1264
+ title: str,
1265
+ address: str,
1266
+ chat_id: int | str | Option[int | str] = Nothing,
1267
+ message_thread_id: Option[int] | int = Nothing,
1268
+ foursquare_id: Option[str] | str = Nothing,
1269
+ foursquare_type: Option[str] | str = Nothing,
1270
+ google_place_id: Option[str] | str = Nothing,
1271
+ google_place_type: Option[str] | str = Nothing,
1272
+ disable_notification: Option[bool] | bool = Nothing,
1273
+ protect_content: Option[bool] | bool = Nothing,
1274
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1275
+ | ReplyParameters
1276
+ | dict[str, typing.Any] = Nothing,
1277
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1278
+ **other: typing.Any,
1279
+ ) -> Result[MessageCute, APIError]:
1280
+ """Shortcut `API.send_venue()`, see the [documentation](https://core.telegram.org/bots/api#sendvenue)
1281
+
1282
+ Use this method to send information about a venue. On success, the sent Message
1283
+ is returned.
1284
+
1285
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1286
+ (in the format @channelusername).
1287
+
1288
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1289
+ forum supergroups only.
1290
+
1291
+ :param latitude: Latitude of the venue.
1292
+
1293
+ :param longitude: Longitude of the venue.
1294
+
1295
+ :param title: Name of the venue.
1296
+
1297
+ :param address: Address of the venue.
1298
+
1299
+ :param foursquare_id: Foursquare identifier of the venue.
1300
+
1301
+ :param foursquare_type: Foursquare type of the venue, if known. (For example, `arts_entertainment/default`, \
1302
+ `arts_entertainment/aquarium` or `food/icecream`.).
1303
+
1304
+ :param google_place_id: Google Places identifier of the venue.
1305
+
1306
+ :param google_place_type: Google Places type of the venue. (See supported types.).
1307
+
1308
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1309
+
1310
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1311
+
1312
+ :param reply_parameters: Description of the message to reply to.
1313
+
1314
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1315
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1316
+ or to force a reply from the user."""
1317
+
1318
+ ...
1319
+
1320
+ @shortcut(
1321
+ "send_dice",
1322
+ executor=execute_method_answer,
1323
+ custom_params={"reply_parameters", "message_thread_id"},
1324
+ )
1325
+ async def answer_dice(
1326
+ self,
1327
+ emoji: Option[DiceEmoji] | DiceEmoji = Nothing,
1328
+ chat_id: int | str | Option[int | str] = Nothing,
1329
+ message_thread_id: Option[int] | int = Nothing,
1330
+ disable_notification: Option[bool] | bool = Nothing,
1331
+ protect_content: Option[bool] | bool = Nothing,
1332
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1333
+ | ReplyParameters
1334
+ | dict[str, typing.Any] = Nothing,
1335
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1336
+ **other: typing.Any,
1337
+ ) -> Result[MessageCute, APIError]:
1338
+ """Shortcut `API.send_dice()`, see the [documentation](https://core.telegram.org/bots/api#senddice)
1339
+
1340
+ Use this method to send an animated emoji that will display a random value.
1341
+ On success, the sent Message is returned.
1342
+
1343
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1344
+ (in the format @channelusername).
1345
+
1346
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1347
+ forum supergroups only.
1348
+
1349
+ :param emoji: Emoji on which the dice throw animation is based. Currently, must be one \
1350
+ of `🎲`, `🎯`, `🏀`, `⚽`, `🎳`, or `🎰`. Dice can have values 1-6 for `🎲`, `🎯` and \
1351
+ `🎳`, values 1-5 for `🏀` and `⚽`, and values 1-64 for `🎰`. Defaults to `🎲`. \
1352
+
1353
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1354
+
1355
+ :param protect_content: Protects the contents of the sent message from forwarding.
1356
+
1357
+ :param reply_parameters: Description of the message to reply to.
1358
+
1359
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1360
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1361
+ or to force a reply from the user."""
1362
+
1363
+ ...
1364
+
1365
+ @shortcut(
1366
+ "send_game",
1367
+ executor=execute_method_answer,
1368
+ custom_params={"reply_parameters", "message_thread_id"},
1369
+ )
1370
+ async def answer_game(
1371
+ self,
1372
+ chat_id: int | str | Option[int | str] = Nothing,
1373
+ message_thread_id: Option[int] | int = Nothing,
1374
+ game_short_name: Option[str] | str = Nothing,
1375
+ disable_notification: Option[bool] | bool = Nothing,
1376
+ protect_content: Option[bool] | bool = Nothing,
1377
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1378
+ | ReplyParameters
1379
+ | dict[str, typing.Any] = Nothing,
1380
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1381
+ **other: typing.Any,
1382
+ ) -> Result[MessageCute, APIError]:
1383
+ """Shortcut `API.send_game()`, see the [documentation](https://core.telegram.org/bots/api#sendgame)
1384
+
1385
+ Use this method to send a game. On success, the sent Message is returned.
1386
+
1387
+ :param chat_id: Unique identifier for the target chat.
1388
+
1389
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1390
+ forum supergroups only.
1391
+
1392
+ :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set \
1393
+ up your games via @BotFather.
1394
+
1395
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1396
+
1397
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1398
+
1399
+ :param reply_parameters: Description of the message to reply to.
1400
+
1401
+ :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' \
1402
+ button will be shown. If not empty, the first button must launch the game."""
1403
+
1404
+ ...
1405
+
1406
+ @shortcut(
1407
+ "send_invoice",
1408
+ executor=execute_method_answer,
1409
+ custom_params={"reply_parameters", "message_thread_id"},
1410
+ )
1411
+ async def answer_invoice(
1412
+ self,
1413
+ title: str,
1414
+ description: str,
1415
+ payload: str,
1416
+ provider_token: str,
1417
+ currency: str,
1418
+ prices: list[LabeledPrice],
1419
+ chat_id: Option[int | str] | int | str = Nothing,
1420
+ message_thread_id: Option[int] | int = Nothing,
1421
+ max_tip_amount: Option[int] | int = Nothing,
1422
+ suggested_tip_amounts: Option[list[int]] | list[int] = Nothing,
1423
+ start_parameter: Option[str] | str = Nothing,
1424
+ provider_data: Option[str] | str = Nothing,
1425
+ photo_url: Option[str] | str = Nothing,
1426
+ photo_size: Option[int] | int = Nothing,
1427
+ photo_width: Option[int] | int = Nothing,
1428
+ photo_height: Option[int] | int = Nothing,
1429
+ need_name: Option[bool] | bool = Nothing,
1430
+ need_phone_number: Option[bool] | bool = Nothing,
1431
+ need_email: Option[bool] | bool = Nothing,
1432
+ need_shipping_address: Option[bool] | bool = Nothing,
1433
+ send_phone_number_to_provider: Option[bool] | bool = Nothing,
1434
+ send_email_to_provider: Option[bool] | bool = Nothing,
1435
+ is_flexible: Option[bool] | bool = Nothing,
1436
+ disable_notification: Option[bool] | bool = Nothing,
1437
+ protect_content: Option[bool] | bool = Nothing,
1438
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1439
+ | ReplyParameters
1440
+ | dict[str, typing.Any] = Nothing,
1441
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
1442
+ **other: typing.Any,
1443
+ ) -> Result[MessageCute, APIError]:
1444
+ """Shortcut `API.send_invoice()`, see the [documentation](https://core.telegram.org/bots/api#sendinvoice)
1445
+
1446
+ Use this method to send invoices. On success, the sent Message is returned.
1447
+
1448
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1449
+ (in the format @channelusername).
1450
+
1451
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1452
+ forum supergroups only.
1453
+
1454
+ :param title: Product name, 1-32 characters.
1455
+
1456
+ :param description: Product description, 1-255 characters.
1457
+
1458
+ :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to \
1459
+ the user, use for your internal processes.
1460
+
1461
+ :param provider_token: Payment provider token, obtained via @BotFather.
1462
+
1463
+ :param currency: Three-letter ISO 4217 currency code, see more on currencies.
1464
+
1465
+ :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, \
1466
+ tax, discount, delivery cost, delivery tax, bonus, etc.).
1467
+
1468
+ :param max_tip_amount: The maximum accepted amount for tips in the smallest units of the currency \
1469
+ (integer, not float/double). For example, for a maximum tip of US$ 1.45 \
1470
+ pass max_tip_amount = 145. See the exp parameter in currencies.json, it \
1471
+ shows the number of digits past the decimal point for each currency (2 for \
1472
+ the majority of currencies). Defaults to 0.
1473
+
1474
+ :param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the smallest units \
1475
+ of the currency (integer, not float/double). At most 4 suggested tip amounts \
1476
+ can be specified. The suggested tip amounts must be positive, passed in \
1477
+ a strictly increased order and must not exceed max_tip_amount.
1478
+
1479
+ :param start_parameter: Unique deep-linking parameter. If left empty, forwarded copies of the \
1480
+ sent message will have a Pay button, allowing multiple users to pay directly \
1481
+ from the forwarded message, using the same invoice. If non-empty, forwarded \
1482
+ copies of the sent message will have a URL button with a deep link to the bot \
1483
+ (instead of a Pay button), with the value used as the start parameter.
1484
+
1485
+ :param provider_data: JSON-serialized data about the invoice, which will be shared with the payment \
1486
+ provider. A detailed description of required fields should be provided \
1487
+ by the payment provider.
1488
+
1489
+ :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or a marketing \
1490
+ image for a service. People like it better when they see what they are paying \
1491
+ for.
1492
+
1493
+ :param photo_size: Photo size in bytes.
1494
+
1495
+ :param photo_width: Photo width.
1496
+
1497
+ :param photo_height: Photo height.
1498
+
1499
+ :param need_name: Pass True if you require the user's full name to complete the order.
1500
+
1501
+ :param need_phone_number: Pass True if you require the user's phone number to complete the order.
1502
+
1503
+ :param need_email: Pass True if you require the user's email address to complete the order. \
1504
+
1505
+ :param need_shipping_address: Pass True if you require the user's shipping address to complete the order. \
1506
+
1507
+ :param send_phone_number_to_provider: Pass True if the user's phone number should be sent to provider.
1508
+
1509
+ :param send_email_to_provider: Pass True if the user's email address should be sent to provider.
1510
+
1511
+ :param is_flexible: Pass True if the final price depends on the shipping method.
1512
+
1513
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1514
+
1515
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1516
+
1517
+ :param reply_parameters: Description of the message to reply to.
1518
+
1519
+ :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Pay total \
1520
+ price' button will be shown. If not empty, the first button must be a Pay button."""
1521
+
1522
+ ...
1523
+
1524
+ @shortcut(
1525
+ "send_chat_action",
1526
+ executor=execute_method_answer,
1527
+ custom_params={"reply_parameters", "message_thread_id"},
1528
+ )
1529
+ async def answer_chat_action(
1530
+ self,
1531
+ action: ChatAction,
1532
+ chat_id: Option[int | str] | int | str = Nothing,
1533
+ message_thread_id: Option[int] | int = Nothing,
1534
+ **other: typing.Any,
1535
+ ) -> Result[bool, APIError]:
1536
+ """Shortcut `API.send_chat_action()`, see the [documentation](https://core.telegram.org/bots/api#sendchataction)
1537
+
1538
+ Use this method when you need to tell the user that something is happening
1539
+ on the bot's side. The status is set for 5 seconds or less (when a message arrives
1540
+ from your bot, Telegram clients clear its typing status). Returns True
1541
+ on success. We only recommend using this method when a response from the
1542
+ bot will take a noticeable amount of time to arrive.
1543
+
1544
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1545
+ (in the format @channelusername).
1546
+
1547
+ :param message_thread_id: Unique identifier for the target message thread; supergroups only.
1548
+
1549
+ :param action: Type of action to broadcast. Choose one, depending on what the user is about \
1550
+ to receive: typing for text messages, upload_photo for photos, record_video \
1551
+ or upload_video for videos, record_voice or upload_voice for voice notes, \
1552
+ upload_document for general files, choose_sticker for stickers, find_location \
1553
+ for location data, record_video_note or upload_video_note for video \
1554
+ notes."""
1555
+
1556
+ ...
1557
+
1558
+ @shortcut(
1559
+ "send_media_group",
1560
+ custom_params={"media", "reply_parameters", "message_thread_id"},
1561
+ )
1562
+ async def answer_media_group(
1563
+ self,
1564
+ media: list[InputMedia | tuple[MediaType, InputFile | str]],
1565
+ chat_id: Option[int | str] | int | str = Nothing,
1566
+ message_thread_id: Option[int] | int = Nothing,
1567
+ caption: str | Option[str] = Nothing,
1568
+ parse_mode: str | Option[str] = Nothing,
1569
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1570
+ disable_notification: Option[bool] | bool = Nothing,
1571
+ protect_content: Option[bool] | bool = Nothing,
1572
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1573
+ | ReplyParameters
1574
+ | dict[str, typing.Any] = Nothing,
1575
+ **other: typing.Any,
1576
+ ) -> Result[list[MessageCute], APIError]:
1577
+ """Shortcut `API.send_media_group()`, see the [documentation](https://core.telegram.org/bots/api#sendmediagroup)
1578
+
1579
+ Use this method to send a group of photos, videos, documents or audios as
1580
+ an album. Documents and audio files can be only grouped in an album with messages
1581
+ of the same type. On success, an array of Messages that were sent is returned.
1582
+
1583
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1584
+ (in the format @channelusername).
1585
+
1586
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1587
+ forum supergroups only.
1588
+
1589
+ :param media: A JSON-serialized array describing messages to be sent, must include 2-10 \
1590
+ items.
1591
+
1592
+ :param caption: Audio caption, 0-1024 characters after entities parsing.
1593
+
1594
+ :param parse_mode: Mode for parsing entities in the audio caption. See formatting options \
1595
+ for more details.
1596
+
1597
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1598
+ which can be specified instead of parse_mode.
1599
+
1600
+ :param disable_notification: Sends messages silently. Users will receive a notification with no sound. \
1601
+
1602
+ :param protect_content: Protects the contents of the sent messages from forwarding and saving. \
1603
+
1604
+ :param reply_parameters: Description of the message to reply to."""
1605
+
1606
+ params = get_params(locals())
1607
+
1608
+ for i, m in enumerate(media[:]):
1609
+ if isinstance(m, tuple):
1610
+ media.insert(
1611
+ i,
1612
+ input_media( # type: ignore
1613
+ *media.pop(i), # type: ignore
1614
+ caption=caption,
1615
+ caption_entities=caption_entities,
1616
+ parse_mode=parse_mode,
1617
+ ),
1618
+ )
1619
+
1620
+ return await execute_method_answer(self, "send_media_group", params)
1621
+
1622
+ @shortcut(
1623
+ "send_location",
1624
+ executor=execute_method_answer,
1625
+ custom_params={"reply_parameters", "message_thread_id"},
1626
+ )
1627
+ async def answer_location(
1628
+ self,
1629
+ latitude: float,
1630
+ longitude: float,
1631
+ chat_id: Option[int | str] | int | str = Nothing,
1632
+ message_thread_id: Option[int] | int = Nothing,
1633
+ horizontal_accuracy: Option[float] | float = Nothing,
1634
+ heading: Option[int] | int = Nothing,
1635
+ live_period: Option[int] | int = Nothing,
1636
+ proximity_alert_radius: Option[int] | int = Nothing,
1637
+ disable_notification: Option[bool] | bool = Nothing,
1638
+ protect_content: Option[bool] | bool = Nothing,
1639
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1640
+ | ReplyParameters
1641
+ | dict[str, typing.Any] = Nothing,
1642
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1643
+ **other: typing.Any,
1644
+ ) -> Result[MessageCute, APIError]:
1645
+ """Shortcut `API.send_location()`, see the [documentation](https://core.telegram.org/bots/api#sendlocation)
1646
+
1647
+ Use this method to send point on the map. On success, the sent Message is returned.
1648
+
1649
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1650
+ (in the format @channelusername).
1651
+
1652
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1653
+ forum supergroups only.
1654
+
1655
+ :param latitude: Latitude of the location.
1656
+
1657
+ :param longitude: Longitude of the location.
1658
+
1659
+ :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500. \
1660
+
1661
+ :param live_period: Period in seconds for which the location will be updated (see Live Locations, \
1662
+ should be between 60 and 86400.
1663
+
1664
+ :param heading: For live locations, a direction in which the user is moving, in degrees. \
1665
+ Must be between 1 and 360 if specified.
1666
+
1667
+ :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching \
1668
+ another chat member, in meters. Must be between 1 and 100000 if specified. \
1669
+
1670
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1671
+
1672
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1673
+
1674
+ :param reply_parameters: Description of the message to reply to.
1675
+
1676
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1677
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1678
+ or to force a reply from the user."""
1679
+
1680
+ ...
1681
+
1682
+ @shortcut(
1683
+ "send_contact",
1684
+ executor=execute_method_answer,
1685
+ custom_params={"reply_parameters", "message_thread_id"},
1686
+ )
1687
+ async def answer_contact(
1688
+ self,
1689
+ phone_number: str,
1690
+ first_name: str,
1691
+ last_name: Option[str] | str = Nothing,
1692
+ vcard: Option[str] | str = Nothing,
1693
+ chat_id: Option[int | str] | int | str = Nothing,
1694
+ message_thread_id: Option[int] | int = Nothing,
1695
+ disable_notification: Option[bool] | bool = Nothing,
1696
+ protect_content: Option[bool] | bool = Nothing,
1697
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1698
+ | ReplyParameters
1699
+ | dict[str, typing.Any] = Nothing,
1700
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
1701
+ **other: typing.Any,
1702
+ ) -> Result[MessageCute, APIError]:
1703
+ """Shortcut `API.send_contact()`, see the [documentation](https://core.telegram.org/bots/api#sendcontact)
1704
+
1705
+ Use this method to send phone contacts. On success, the sent Message is returned.
1706
+
1707
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1708
+ (in the format @channelusername).
1709
+
1710
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1711
+ forum supergroups only.
1712
+
1713
+ :param phone_number: Contact's phone number.
1714
+
1715
+ :param first_name: Contact's first name.
1716
+
1717
+ :param last_name: Contact's last name.
1718
+
1719
+ :param vcard: Additional data about the contact in the form of a vCard, 0-2048 bytes.
1720
+
1721
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1722
+
1723
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1724
+
1725
+ :param reply_parameters: Description of the message to reply to.
1726
+
1727
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1728
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1729
+ or to force a reply from the user."""
1730
+
1731
+ ...
1732
+
1733
+ @shortcut(
1734
+ "send_audio",
1735
+ executor=execute_method_reply,
1736
+ custom_params={"reply_parameters", "message_thread_id"},
1737
+ )
1738
+ async def reply_audio(
1739
+ self,
1740
+ audio: str | InputFile,
1741
+ chat_id: int | str | Option[int | str] = Nothing,
1742
+ message_thread_id: int | Option[int] = Nothing,
1743
+ caption: str | Option[str] = Nothing,
1744
+ parse_mode: str | Option[str] = Nothing,
1745
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1746
+ duration: int | Option[int] = Nothing,
1747
+ performer: str | Option[str] = Nothing,
1748
+ title: str | Option[str] = Nothing,
1749
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
1750
+ disable_notification: Option[bool] | bool = Nothing,
1751
+ protect_content: bool | Option[bool] = Nothing,
1752
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1753
+ | ReplyParameters
1754
+ | dict[str, typing.Any] = Nothing,
1755
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1756
+ **other: typing.Any,
1757
+ ) -> Result[MessageCute, APIError]:
1758
+ """Shortcut `API.send_audio()`, see the [documentation](https://core.telegram.org/bots/api#sendaudio)
1759
+
1760
+ Use this method to send a reply to a message with audio files, if you want Telegram clients to display
1761
+ them in the music player. Your audio must be in the .MP3 or .M4A format. On
1762
+ success, the sent Message is returned. Bots can currently send audio files
1763
+ of up to 50 MB in size, this limit may be changed in the future. For sending
1764
+ voice messages, use the sendVoice method instead.
1765
+
1766
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1767
+ (in the format @channelusername).
1768
+
1769
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1770
+ forum supergroups only.
1771
+
1772
+ :param audio: Audio file to send. Pass a file_id as String to send an audio file that exists \
1773
+ on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
1774
+ to get an audio file from the Internet, or upload a new one using multipart/form-data. \
1775
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1776
+
1777
+ :param caption: Audio caption, 0-1024 characters after entities parsing.
1778
+
1779
+ :param parse_mode: Mode for parsing entities in the audio caption. See formatting options \
1780
+ for more details.
1781
+
1782
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1783
+ which can be specified instead of parse_mode.
1784
+
1785
+ :param duration: Duration of the audio in seconds.
1786
+
1787
+ :param performer: Performer.
1788
+
1789
+ :param title: Track name.
1790
+
1791
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
1792
+ file is supported server-side. The thumbnail should be in JPEG format and \
1793
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
1794
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
1795
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
1796
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
1797
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1798
+
1799
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1800
+
1801
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1802
+
1803
+ :param reply_parameters: Description of the message to reply to.
1804
+
1805
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1806
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1807
+ or to force a reply from the user."""
1808
+
1809
+ ...
1810
+
1811
+ @shortcut(
1812
+ "send_animation",
1813
+ executor=execute_method_reply,
1814
+ custom_params={"reply_parameters", "message_thread_id"},
1815
+ )
1816
+ async def reply_animation(
1817
+ self,
1818
+ animation: str | InputFile,
1819
+ chat_id: int | str | Option[int | str] = Nothing,
1820
+ message_thread_id: int | Option[int] = Nothing,
1821
+ caption: str | Option[str] = Nothing,
1822
+ parse_mode: str | Option[str] = Nothing,
1823
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1824
+ duration: int | Option[int] = Nothing,
1825
+ width: int | Option[int] = Nothing,
1826
+ height: int | Option[int] = Nothing,
1827
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
1828
+ has_spoiler: bool | Option[bool] = Nothing,
1829
+ disable_notification: Option[bool] | bool = Nothing,
1830
+ protect_content: bool | Option[bool] = Nothing,
1831
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1832
+ | ReplyParameters
1833
+ | dict[str, typing.Any] = Nothing,
1834
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1835
+ **other: typing.Any,
1836
+ ) -> Result[MessageCute, APIError]:
1837
+ """Shortcut `API.send_animation()`, see the [documentation](https://core.telegram.org/bots/api#sendanimation)
1838
+
1839
+ Use this method to send a reply to a message with animation files (GIF or H.264/MPEG-4 AVC video without
1840
+ sound). On success, the sent Message is returned. Bots can currently send
1841
+ animation files of up to 50 MB in size, this limit may be changed in the future.
1842
+
1843
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1844
+ (in the format @channelusername).
1845
+
1846
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1847
+ forum supergroups only.
1848
+
1849
+ :param animation: Animation to send. Pass a file_id as String to send an animation that exists \
1850
+ on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
1851
+ to get an animation from the Internet, or upload a new animation using multipart/form-data. \
1852
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1853
+
1854
+ :param duration: Duration of sent animation in seconds.
1855
+
1856
+ :param width: Animation width.
1857
+
1858
+ :param height: Animation height.
1859
+
1860
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
1861
+ file is supported server-side. The thumbnail should be in JPEG format and \
1862
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
1863
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
1864
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
1865
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
1866
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1867
+
1868
+ :param caption: Animation caption (may also be used when resending animation by file_id), \
1869
+ 0-1024 characters after entities parsing.
1870
+
1871
+ :param parse_mode: Mode for parsing entities in the animation caption. See formatting options \
1872
+ for more details.
1873
+
1874
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1875
+ which can be specified instead of parse_mode.
1876
+
1877
+ :param has_spoiler: Pass True if the animation needs to be covered with a spoiler animation. \
1878
+
1879
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1880
+
1881
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1882
+
1883
+ :param reply_parameters: Description of the message to reply to.
1884
+
1885
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1886
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1887
+ or to force a reply from the user."""
1888
+
1889
+ ...
1890
+
1891
+ @shortcut(
1892
+ "send_document",
1893
+ executor=execute_method_reply,
1894
+ custom_params={"reply_parameters", "message_thread_id"},
1895
+ )
1896
+ async def reply_document(
1897
+ self,
1898
+ document: str | InputFile,
1899
+ chat_id: int | str | Option[int | str] = Nothing,
1900
+ message_thread_id: int | Option[int] = Nothing,
1901
+ caption: str | Option[str] = Nothing,
1902
+ parse_mode: str | Option[str] = Nothing,
1903
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1904
+ disable_content_type_detection: Option[bool] | bool = Nothing,
1905
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
1906
+ disable_notification: Option[bool] | bool = Nothing,
1907
+ protect_content: bool | Option[bool] = Nothing,
1908
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1909
+ | ReplyParameters
1910
+ | dict[str, typing.Any] = Nothing,
1911
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1912
+ **other: typing.Any,
1913
+ ) -> Result[MessageCute, APIError]:
1914
+ """Shortcut `API.send_document()`, see the [documentation](https://core.telegram.org/bots/api#senddocument)
1915
+
1916
+ Use this method to send a reply to a message with general files. On success, the sent Message is returned.
1917
+ Bots can currently send files of any type of up to 50 MB in size, this limit
1918
+ may be changed in the future.
1919
+
1920
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1921
+ (in the format @channelusername).
1922
+
1923
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1924
+ forum supergroups only.
1925
+
1926
+ :param document: File to send. Pass a file_id as String to send a file that exists on the Telegram \
1927
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
1928
+ file from the Internet, or upload a new one using multipart/form-data. \
1929
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1930
+
1931
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
1932
+ file is supported server-side. The thumbnail should be in JPEG format and \
1933
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
1934
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
1935
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
1936
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
1937
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
1938
+
1939
+ :param caption: Document caption (may also be used when resending documents by file_id), \
1940
+ 0-1024 characters after entities parsing.
1941
+
1942
+ :param parse_mode: Mode for parsing entities in the document caption. See formatting options \
1943
+ for more details.
1944
+
1945
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
1946
+ which can be specified instead of parse_mode.
1947
+
1948
+ :param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded \
1949
+ using multipart/form-data.
1950
+
1951
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
1952
+
1953
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
1954
+
1955
+ :param reply_parameters: Description of the message to reply to.
1956
+
1957
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
1958
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
1959
+ or to force a reply from the user."""
1960
+
1961
+ ...
1962
+
1963
+ @shortcut(
1964
+ "send_photo",
1965
+ executor=execute_method_reply,
1966
+ custom_params={"reply_parameters", "message_thread_id"},
1967
+ )
1968
+ async def reply_photo(
1969
+ self,
1970
+ photo: str | InputFile,
1971
+ chat_id: int | str | Option[int | str] = Nothing,
1972
+ message_thread_id: int | Option[int] = Nothing,
1973
+ caption: str | Option[str] = Nothing,
1974
+ parse_mode: str | Option[str] = Nothing,
1975
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
1976
+ has_spoiler: bool | Option[bool] = Nothing,
1977
+ disable_notification: Option[bool] | bool = Nothing,
1978
+ protect_content: bool | Option[bool] = Nothing,
1979
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
1980
+ | ReplyParameters
1981
+ | dict[str, typing.Any] = Nothing,
1982
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
1983
+ **other: typing.Any,
1984
+ ) -> Result[MessageCute, APIError]:
1985
+ """Shortcut `API.send_photo()`, see the [documentation](https://core.telegram.org/bots/api#sendphoto)
1986
+
1987
+ Use this method to send a reply to a message with photos. On success, the sent Message is returned.
1988
+
1989
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
1990
+ (in the format @channelusername).
1991
+
1992
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
1993
+ forum supergroups only.
1994
+
1995
+ :param photo: Photo to send. Pass a file_id as String to send a photo that exists on the Telegram \
1996
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
1997
+ photo from the Internet, or upload a new photo using multipart/form-data. \
1998
+ The photo must be at most 10 MB in size. The photo's width and height must not \
1999
+ exceed 10000 in total. Width and height ratio must be at most 20. More information \
2000
+ on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2001
+
2002
+ :param caption: Photo caption (may also be used when resending photos by file_id), 0-1024 \
2003
+ characters after entities parsing.
2004
+
2005
+ :param parse_mode: Mode for parsing entities in the photo caption. See formatting options \
2006
+ for more details.
2007
+
2008
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2009
+ which can be specified instead of parse_mode.
2010
+
2011
+ :param has_spoiler: Pass True if the photo needs to be covered with a spoiler animation.
2012
+
2013
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2014
+
2015
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2016
+
2017
+ :param reply_parameters: Description of the message to reply to.
2018
+
2019
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2020
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2021
+ or to force a reply from the user."""
2022
+
2023
+ ...
2024
+
2025
+ @shortcut(
2026
+ "send_sticker",
2027
+ executor=execute_method_reply,
2028
+ custom_params={"reply_parameters", "message_thread_id"},
2029
+ )
2030
+ async def reply_sticker(
2031
+ self,
2032
+ sticker: str | InputFile,
2033
+ chat_id: int | str | Option[int | str] = Nothing,
2034
+ emoji: str | Option[str] = Nothing,
2035
+ message_thread_id: int | Option[int] = Nothing,
2036
+ disable_notification: Option[bool] | bool = Nothing,
2037
+ protect_content: bool | Option[bool] = Nothing,
2038
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2039
+ | ReplyParameters
2040
+ | dict[str, typing.Any] = Nothing,
2041
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
2042
+ **other: typing.Any,
2043
+ ) -> Result[MessageCute, APIError]:
2044
+ """Shortcut `API.send_sticker()`, see the [documentation](https://core.telegram.org/bots/api#sendsticker)
2045
+
2046
+ Use this method to send a reply to a message with static .WEBP, animated .TGS, or video .WEBM stickers.
2047
+ On success, the sent Message is returned.
2048
+
2049
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2050
+ (in the format @channelusername).
2051
+
2052
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2053
+ forum supergroups only.
2054
+
2055
+ :param sticker: Sticker to send. Pass a file_id as String to send a file that exists on the \
2056
+ Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
2057
+ to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker \
2058
+ using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2059
+ Video stickers can only be sent by a file_id. Animated stickers can't be \
2060
+ sent via an HTTP URL.
2061
+
2062
+ :param emoji: Emoji associated with the sticker; only for just uploaded stickers.
2063
+
2064
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2065
+
2066
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2067
+
2068
+ :param reply_parameters: Description of the message to reply to.
2069
+
2070
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2071
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2072
+ or to force a reply from the user."""
2073
+
2074
+ ...
2075
+
2076
+ @shortcut(
2077
+ "send_video",
2078
+ executor=execute_method_reply,
2079
+ custom_params={"reply_parameters", "message_thread_id"},
2080
+ )
2081
+ async def reply_video(
2082
+ self,
2083
+ video: str | InputFile,
2084
+ chat_id: int | str | Option[int | str] = Nothing,
2085
+ message_thread_id: int | Option[int] = Nothing,
2086
+ caption: str | Option[str] = Nothing,
2087
+ parse_mode: str | Option[str] = Nothing,
2088
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
2089
+ duration: int | Option[int] = Nothing,
2090
+ width: int | Option[int] = Nothing,
2091
+ height: int | Option[int] = Nothing,
2092
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
2093
+ has_spoiler: bool | Option[bool] = Nothing,
2094
+ supports_streaming: bool | Option[bool] = Nothing,
2095
+ disable_notification: Option[bool] | bool = Nothing,
2096
+ protect_content: bool | Option[bool] = Nothing,
2097
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2098
+ | ReplyParameters
2099
+ | dict[str, typing.Any] = Nothing,
2100
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
2101
+ **other: typing.Any,
2102
+ ) -> Result[MessageCute, APIError]:
2103
+ """Shortcut `API.send_video()`, see the [documentation](https://core.telegram.org/bots/api#sendvideo)
2104
+
2105
+ Use this method to send a reply to a message with video files, Telegram clients support MPEG4 videos
2106
+ (other formats may be sent as Document). On success, the sent Message is
2107
+ returned. Bots can currently send video files of up to 50 MB in size, this
2108
+ limit may be changed in the future.
2109
+
2110
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2111
+ (in the format @channelusername).
2112
+
2113
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2114
+ forum supergroups only.
2115
+
2116
+ :param video: Video to send. Pass a file_id as String to send a video that exists on the Telegram \
2117
+ servers (recommended), pass an HTTP URL as a String for Telegram to get a \
2118
+ video from the Internet, or upload a new video using multipart/form-data. \
2119
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2120
+
2121
+ :param duration: Duration of sent video in seconds.
2122
+
2123
+ :param width: Video width.
2124
+
2125
+ :param height: Video height.
2126
+
2127
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
2128
+ file is supported server-side. The thumbnail should be in JPEG format and \
2129
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
2130
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
2131
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
2132
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
2133
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2134
+
2135
+ :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 \
2136
+ characters after entities parsing.
2137
+
2138
+ :param parse_mode: Mode for parsing entities in the video caption. See formatting options \
2139
+ for more details.
2140
+
2141
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2142
+ which can be specified instead of parse_mode.
2143
+
2144
+ :param has_spoiler: Pass True if the video needs to be covered with a spoiler animation.
2145
+
2146
+ :param supports_streaming: Pass True if the uploaded video is suitable for streaming.
2147
+
2148
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2149
+
2150
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2151
+
2152
+ :param reply_parameters: Description of the message to reply to.
2153
+
2154
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2155
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2156
+ or to force a reply from the user."""
2157
+
2158
+ ...
2159
+
2160
+ @shortcut(
2161
+ "send_video_note",
2162
+ executor=execute_method_reply,
2163
+ custom_params={"reply_parameters", "message_thread_id"},
2164
+ )
2165
+ async def reply_video_note(
2166
+ self,
2167
+ video_note: str | InputFile,
2168
+ chat_id: int | str | Option[int | str] = Nothing,
2169
+ duration: int | Option[int] = Nothing,
2170
+ length: int | Option[int] = Nothing,
2171
+ message_thread_id: int | Option[int] = Nothing,
2172
+ thumbnail: Option[InputFile | str] | InputFile | str = Nothing,
2173
+ disable_notification: Option[bool] | bool = Nothing,
2174
+ protect_content: bool | Option[bool] = Nothing,
2175
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2176
+ | ReplyParameters
2177
+ | dict[str, typing.Any] = Nothing,
2178
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
2179
+ **other: typing.Any,
2180
+ ) -> Result[MessageCute, APIError]:
2181
+ """Shortcut `API.send_video_note()`, see the [documentation](https://core.telegram.org/bots/api#sendvideonote)
2182
+
2183
+ As of v.4.0, Telegram clients support rounded square MPEG4 videos of up
2184
+ to 1 minute long. Use this method to send a reply to a message with video messages. On success, the
2185
+ sent Message is returned.
2186
+
2187
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2188
+ (in the format @channelusername).
2189
+
2190
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2191
+ forum supergroups only.
2192
+
2193
+ :param video_note: Video note to send. Pass a file_id as String to send a video note that exists \
2194
+ on the Telegram servers (recommended) or upload a new video using multipart/form-data. \
2195
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2196
+ Sending video notes by a URL is currently unsupported.
2197
+
2198
+ :param duration: Duration of sent video in seconds.
2199
+
2200
+ :param length: Video width and height, i.e. diameter of the video message.
2201
+
2202
+ :param thumbnail: Thumbnail of the file sent; can be ignored if thumbnail generation for the \
2203
+ file is supported server-side. The thumbnail should be in JPEG format and \
2204
+ less than 200 kB in size. A thumbnail's width and height should not exceed \
2205
+ 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails \
2206
+ can't be reused and can be only uploaded as a new file, so you can pass `attach://<file_attach_name>` \
2207
+ if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
2208
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2209
+
2210
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2211
+
2212
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2213
+
2214
+ :param reply_parameters: Description of the message to reply to.
2215
+
2216
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2217
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2218
+ or to force a reply from the user."""
2219
+
2220
+ ...
2221
+
2222
+ @shortcut(
2223
+ "send_voice",
2224
+ executor=execute_method_reply,
2225
+ custom_params={"reply_parameters", "message_thread_id"},
2226
+ )
2227
+ async def reply_voice(
2228
+ self,
2229
+ voice: str | InputFile,
2230
+ chat_id: int | str | Option[int | str] = Nothing,
2231
+ message_thread_id: int | Option[int] = Nothing,
2232
+ caption: str | Option[str] = Nothing,
2233
+ parse_mode: str | Option[str] = Nothing,
2234
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
2235
+ duration: int | Option[int] = Nothing,
2236
+ disable_notification: Option[bool] | bool = Nothing,
2237
+ protect_content: bool | Option[bool] = Nothing,
2238
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2239
+ | ReplyParameters
2240
+ | dict[str, typing.Any] = Nothing,
2241
+ reply_markup: ReplyMarkup | Option[ReplyMarkup] = Nothing,
2242
+ **other: typing.Any,
2243
+ ) -> Result[MessageCute, APIError]:
2244
+ """Shortcut `API.send_voice()`, see the [documentation](https://core.telegram.org/bots/api#sendvoice)
2245
+
2246
+ Use this method to send a reply to a message with audio files, if you want Telegram clients to display
2247
+ the file as a playable voice message. For this to work, your audio must be
2248
+ in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
2249
+ On success, the sent Message is returned. Bots can currently send voice
2250
+ messages of up to 50 MB in size, this limit may be changed in the future.
2251
+
2252
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2253
+ (in the format @channelusername).
2254
+
2255
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2256
+ forum supergroups only.
2257
+
2258
+ :param voice: Audio file to send. Pass a file_id as String to send a file that exists on the \
2259
+ Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
2260
+ to get a file from the Internet, or upload a new one using multipart/form-data. \
2261
+ More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
2262
+
2263
+ :param caption: Voice message caption, 0-1024 characters after entities parsing.
2264
+
2265
+ :param parse_mode: Mode for parsing entities in the voice message caption. See formatting \
2266
+ options for more details.
2267
+
2268
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2269
+ which can be specified instead of parse_mode.
2270
+
2271
+ :param duration: Duration of the voice message in seconds.
2272
+
2273
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2274
+
2275
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2276
+
2277
+ :param reply_parameters: Description of the message to reply to.
2278
+
2279
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2280
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2281
+ or to force a reply from the user."""
2282
+
2283
+ ...
2284
+
2285
+ @shortcut(
2286
+ "send_poll",
2287
+ executor=execute_method_reply,
2288
+ custom_params={"reply_parameters", "message_thread_id"},
2289
+ )
2290
+ async def reply_poll(
2291
+ self,
2292
+ question: str,
2293
+ options: list[str],
2294
+ chat_id: int | str | Option[int | str] = Nothing,
2295
+ message_thread_id: Option[int] | int = Nothing,
2296
+ is_anonymous: Option[bool] | bool = Nothing,
2297
+ type: Option[typing.Literal["quiz", "regular"]]
2298
+ | typing.Literal["quiz", "regular"] = Nothing,
2299
+ allows_multiple_answers: Option[bool] | bool = Nothing,
2300
+ correct_option_id: Option[int] | int = Nothing,
2301
+ explanation: Option[str] | str = Nothing,
2302
+ explanation_parse_mode: Option[str] | str = Nothing,
2303
+ explanation_entities: Option[list[MessageEntity]]
2304
+ | list[MessageEntity] = Nothing,
2305
+ open_period: Option[int] | int = Nothing,
2306
+ close_date: Option[datetime | int] | datetime | int = Nothing,
2307
+ is_closed: Option[bool] | bool = Nothing,
2308
+ disable_notification: Option[bool] | bool = Nothing,
2309
+ protect_content: Option[bool] | bool = Nothing,
2310
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2311
+ | ReplyParameters
2312
+ | dict[str, typing.Any] = Nothing,
2313
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2314
+ **other: typing.Any,
2315
+ ) -> Result[MessageCute, APIError]:
2316
+ """Shortcut `API.send_poll()`, see the [documentation](https://core.telegram.org/bots/api#sendpoll)
2317
+
2318
+ Use this method to send a reply to a message with a native poll. On success, the sent Message is returned.
2319
+
2320
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2321
+ (in the format @channelusername).
2322
+
2323
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2324
+ forum supergroups only.
2325
+
2326
+ :param question: Poll question, 1-300 characters.
2327
+
2328
+ :param options: A JSON-serialized list of answer options, 2-10 strings 1-100 characters \
2329
+ each.
2330
+
2331
+ :param is_anonymous: True, if the poll needs to be anonymous, defaults to True.
2332
+
2333
+ :param type: Poll type, `quiz` or `regular`, defaults to `regular`.
2334
+
2335
+ :param allows_multiple_answers: True, if the poll allows multiple answers, ignored for polls in quiz mode, \
2336
+ defaults to False.
2337
+
2338
+ :param correct_option_id: 0-based identifier of the correct answer option, required for polls in \
2339
+ quiz mode.
2340
+
2341
+ :param explanation: Text that is shown when a user chooses an incorrect answer or taps on the lamp \
2342
+ icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after \
2343
+ entities parsing.
2344
+
2345
+ :param explanation_parse_mode: Mode for parsing entities in the explanation. See formatting options for \
2346
+ more details.
2347
+
2348
+ :param explanation_entities: A JSON-serialized list of special entities that appear in the poll explanation, \
2349
+ which can be specified instead of parse_mode.
2350
+
2351
+ :param open_period: Amount of time in seconds the poll will be active after creation, 5-600. \
2352
+ Can't be used together with close_date.
2353
+
2354
+ :param close_date: Point in time (Unix timestamp) when the poll will be automatically closed. \
2355
+ Must be at least 5 and no more than 600 seconds in the future. Can't be used \
2356
+ together with open_period.
2357
+
2358
+ :param is_closed: Pass True if the poll needs to be immediately closed. This can be useful for \
2359
+ poll preview.
2360
+
2361
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2362
+
2363
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2364
+
2365
+ :param reply_parameters: Description of the message to reply to.
2366
+
2367
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2368
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2369
+ or to force a reply from the user."""
2370
+
2371
+ ...
2372
+
2373
+ @shortcut(
2374
+ "send_venue",
2375
+ executor=execute_method_reply,
2376
+ custom_params={"reply_parameters", "message_thread_id"},
2377
+ )
2378
+ async def reply_venue(
2379
+ self,
2380
+ latitude: float,
2381
+ longitude: float,
2382
+ title: str,
2383
+ address: str,
2384
+ chat_id: int | str | Option[int | str] = Nothing,
2385
+ message_thread_id: Option[int] | int = Nothing,
2386
+ foursquare_id: Option[str] | str = Nothing,
2387
+ foursquare_type: Option[str] | str = Nothing,
2388
+ google_place_id: Option[str] | str = Nothing,
2389
+ google_place_type: Option[str] | str = Nothing,
2390
+ disable_notification: Option[bool] | bool = Nothing,
2391
+ protect_content: Option[bool] | bool = Nothing,
2392
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2393
+ | ReplyParameters
2394
+ | dict[str, typing.Any] = Nothing,
2395
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2396
+ **other: typing.Any,
2397
+ ) -> Result[MessageCute, APIError]:
2398
+ """Shortcut `API.send_venue()`, see the [documentation](https://core.telegram.org/bots/api#sendvenue)
2399
+
2400
+ Use this method to send a reply to a message with information about a venue. On success, the sent Message
2401
+ is returned.
2402
+
2403
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2404
+ (in the format @channelusername).
2405
+
2406
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2407
+ forum supergroups only.
2408
+
2409
+ :param latitude: Latitude of the venue.
2410
+
2411
+ :param longitude: Longitude of the venue.
2412
+
2413
+ :param title: Name of the venue.
2414
+
2415
+ :param address: Address of the venue.
2416
+
2417
+ :param foursquare_id: Foursquare identifier of the venue.
2418
+
2419
+ :param foursquare_type: Foursquare type of the venue, if known. (For example, `arts_entertainment/default`, \
2420
+ `arts_entertainment/aquarium` or `food/icecream`.).
2421
+
2422
+ :param google_place_id: Google Places identifier of the venue.
2423
+
2424
+ :param google_place_type: Google Places type of the venue. (See supported types.).
2425
+
2426
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2427
+
2428
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2429
+
2430
+ :param reply_parameters: Description of the message to reply to.
2431
+
2432
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2433
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2434
+ or to force a reply from the user."""
2435
+
2436
+ ...
2437
+
2438
+ @shortcut(
2439
+ "send_dice",
2440
+ executor=execute_method_reply,
2441
+ custom_params={"reply_parameters", "message_thread_id"},
2442
+ )
2443
+ async def reply_dice(
2444
+ self,
2445
+ chat_id: int | str | Option[int | str] = Nothing,
2446
+ message_thread_id: Option[int] | int = Nothing,
2447
+ emoji: Option[DiceEmoji] | DiceEmoji = Nothing,
2448
+ disable_notification: Option[bool] | bool = Nothing,
2449
+ protect_content: Option[bool] | bool = Nothing,
2450
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2451
+ | ReplyParameters
2452
+ | dict[str, typing.Any] = Nothing,
2453
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2454
+ **other: typing.Any,
2455
+ ) -> Result[MessageCute, APIError]:
2456
+ """Shortcut `API.send_dice()`, see the [documentation](https://core.telegram.org/bots/api#senddice)
2457
+
2458
+ Use this method to send a reply to a message with an animated emoji that will display a random value.
2459
+ On success, the sent Message is returned.
2460
+
2461
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2462
+ (in the format @channelusername).
2463
+
2464
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2465
+ forum supergroups only.
2466
+
2467
+ :param emoji: Emoji on which the dice throw animation is based. Currently, must be one \
2468
+ of `🎲`, `🎯`, `🏀`, `⚽`, `🎳`, or `🎰`. Dice can have values 1-6 for `🎲`, `🎯` and \
2469
+ `🎳`, values 1-5 for `🏀` and `⚽`, and values 1-64 for `🎰`. Defaults to `🎲`. \
2470
+
2471
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2472
+
2473
+ :param protect_content: Protects the contents of the sent message from forwarding.
2474
+
2475
+ :param reply_parameters: Description of the message to reply to.
2476
+
2477
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2478
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2479
+ or to force a reply from the user."""
2480
+
2481
+ ...
2482
+
2483
+ @shortcut(
2484
+ "send_game",
2485
+ executor=execute_method_reply,
2486
+ custom_params={"reply_parameters", "message_thread_id"},
2487
+ )
2488
+ async def reply_game(
2489
+ self,
2490
+ chat_id: int | str | Option[int | str] = Nothing,
2491
+ message_thread_id: Option[int] | int = Nothing,
2492
+ game_short_name: Option[str] | str = Nothing,
2493
+ disable_notification: Option[bool] | bool = Nothing,
2494
+ protect_content: Option[bool] | bool = Nothing,
2495
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2496
+ | ReplyParameters
2497
+ | dict[str, typing.Any] = Nothing,
2498
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2499
+ **other: typing.Any,
2500
+ ) -> Result[MessageCute, APIError]:
2501
+ """Shortcut `API.send_game()`, see the [documentation](https://core.telegram.org/bots/api#sendgame)
2502
+
2503
+ Use this method to send a reply to a message with a game. On success, the sent Message is returned.
2504
+
2505
+ :param chat_id: Unique identifier for the target chat.
2506
+
2507
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2508
+ forum supergroups only.
2509
+
2510
+ :param game_short_name: Short name of the game, serves as the unique identifier for the game. Set \
2511
+ up your games via @BotFather.
2512
+
2513
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2514
+
2515
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2516
+
2517
+ :param reply_parameters: Description of the message to reply to.
2518
+
2519
+ :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' \
2520
+ button will be shown. If not empty, the first button must launch the game."""
2521
+
2522
+ ...
2523
+
2524
+ @shortcut(
2525
+ "send_invoice",
2526
+ executor=execute_method_reply,
2527
+ custom_params={"reply_parameters", "message_thread_id"},
2528
+ )
2529
+ async def reply_invoice(
2530
+ self,
2531
+ title: str,
2532
+ description: str,
2533
+ payload: str,
2534
+ provider_token: str,
2535
+ currency: str,
2536
+ prices: list[LabeledPrice],
2537
+ chat_id: Option[int | str] | int | str = Nothing,
2538
+ message_thread_id: Option[int] | int = Nothing,
2539
+ max_tip_amount: Option[int] | int = Nothing,
2540
+ suggested_tip_amounts: Option[list[int]] | list[int] = Nothing,
2541
+ start_parameter: Option[str] | str = Nothing,
2542
+ provider_data: Option[str] | str = Nothing,
2543
+ photo_url: Option[str] | str = Nothing,
2544
+ photo_size: Option[int] | int = Nothing,
2545
+ photo_width: Option[int] | int = Nothing,
2546
+ photo_height: Option[int] | int = Nothing,
2547
+ need_name: Option[bool] | bool = Nothing,
2548
+ need_phone_number: Option[bool] | bool = Nothing,
2549
+ need_email: Option[bool] | bool = Nothing,
2550
+ need_shipping_address: Option[bool] | bool = Nothing,
2551
+ send_phone_number_to_provider: Option[bool] | bool = Nothing,
2552
+ send_email_to_provider: Option[bool] | bool = Nothing,
2553
+ is_flexible: Option[bool] | bool = Nothing,
2554
+ disable_notification: Option[bool] | bool = Nothing,
2555
+ protect_content: Option[bool] | bool = Nothing,
2556
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2557
+ | ReplyParameters
2558
+ | dict[str, typing.Any] = Nothing,
2559
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
2560
+ **other: typing.Any,
2561
+ ) -> Result[MessageCute, APIError]:
2562
+ """Shortcut `API.send_invoice()`, see the [documentation](https://core.telegram.org/bots/api#sendinvoice)
2563
+
2564
+ Use this method to send a reply to a message with invoices. On success, the sent Message is returned.
2565
+
2566
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2567
+ (in the format @channelusername).
2568
+
2569
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2570
+ forum supergroups only.
2571
+
2572
+ :param title: Product name, 1-32 characters.
2573
+
2574
+ :param description: Product description, 1-255 characters.
2575
+
2576
+ :param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to \
2577
+ the user, use for your internal processes.
2578
+
2579
+ :param provider_token: Payment provider token, obtained via @BotFather.
2580
+
2581
+ :param currency: Three-letter ISO 4217 currency code, see more on currencies.
2582
+
2583
+ :param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, \
2584
+ tax, discount, delivery cost, delivery tax, bonus, etc.).
2585
+
2586
+ :param max_tip_amount: The maximum accepted amount for tips in the smallest units of the currency \
2587
+ (integer, not float/double). For example, for a maximum tip of US$ 1.45 \
2588
+ pass max_tip_amount = 145. See the exp parameter in currencies.json, it \
2589
+ shows the number of digits past the decimal point for each currency (2 for \
2590
+ the majority of currencies). Defaults to 0.
2591
+
2592
+ :param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the smallest units \
2593
+ of the currency (integer, not float/double). At most 4 suggested tip amounts \
2594
+ can be specified. The suggested tip amounts must be positive, passed in \
2595
+ a strictly increased order and must not exceed max_tip_amount.
2596
+
2597
+ :param start_parameter: Unique deep-linking parameter. If left empty, forwarded copies of the \
2598
+ sent message will have a Pay button, allowing multiple users to pay directly \
2599
+ from the forwarded message, using the same invoice. If non-empty, forwarded \
2600
+ copies of the sent message will have a URL button with a deep link to the bot \
2601
+ (instead of a Pay button), with the value used as the start parameter.
2602
+
2603
+ :param provider_data: JSON-serialized data about the invoice, which will be shared with the payment \
2604
+ provider. A detailed description of required fields should be provided \
2605
+ by the payment provider.
2606
+
2607
+ :param photo_url: URL of the product photo for the invoice. Can be a photo of the goods or a marketing \
2608
+ image for a service. People like it better when they see what they are paying \
2609
+ for.
2610
+
2611
+ :param photo_size: Photo size in bytes.
2612
+
2613
+ :param photo_width: Photo width.
2614
+
2615
+ :param photo_height: Photo height.
2616
+
2617
+ :param need_name: Pass True if you require the user's full name to complete the order.
2618
+
2619
+ :param need_phone_number: Pass True if you require the user's phone number to complete the order.
2620
+
2621
+ :param need_email: Pass True if you require the user's email address to complete the order. \
2622
+
2623
+ :param need_shipping_address: Pass True if you require the user's shipping address to complete the order. \
2624
+
2625
+ :param send_phone_number_to_provider: Pass True if the user's phone number should be sent to provider.
2626
+
2627
+ :param send_email_to_provider: Pass True if the user's email address should be sent to provider.
2628
+
2629
+ :param is_flexible: Pass True if the final price depends on the shipping method.
2630
+
2631
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2632
+
2633
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2634
+
2635
+ :param reply_parameters: Description of the message to reply to.
2636
+
2637
+ :param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Pay total \
2638
+ price' button will be shown. If not empty, the first button must be a Pay button."""
2639
+
2640
+ ...
2641
+
2642
+ @shortcut(
2643
+ "send_media_group",
2644
+ custom_params={
2645
+ "media",
2646
+ "reply_parameters",
2647
+ "message_thread_id",
2648
+ "caption",
2649
+ "caption_entities",
2650
+ "parse_mode",
2651
+ },
2652
+ )
2653
+ async def reply_media_group(
2654
+ self,
2655
+ media: list[InputMedia | tuple[MediaType, InputFile | str]],
2656
+ chat_id: Option[int | str] | int | str = Nothing,
2657
+ message_thread_id: Option[int] | int = Nothing,
2658
+ caption: str | Option[str] = Nothing,
2659
+ parse_mode: str | Option[str] = Nothing,
2660
+ caption_entities: list[MessageEntity] | Option[list[MessageEntity]] = Nothing,
2661
+ disable_notification: Option[bool] | bool = Nothing,
2662
+ protect_content: Option[bool] | bool = Nothing,
2663
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2664
+ | ReplyParameters
2665
+ | dict[str, typing.Any] = Nothing,
2666
+ **other: typing.Any,
2667
+ ) -> Result[list[MessageCute], APIError]:
2668
+ """Shortcut `API.send_media_group()`, see the [documentation](https://core.telegram.org/bots/api#sendmediagroup)
2669
+
2670
+ Use this method to send a reply to a message with a group of photos, videos, documents or audios as
2671
+ an album. Documents and audio files can be only grouped in an album with messages
2672
+ of the same type. On success, an array of Messages that were sent is returned.
2673
+
2674
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2675
+ (in the format @channelusername).
2676
+
2677
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2678
+ forum supergroups only.
2679
+
2680
+ :param media: A JSON-serialized array describing messages to be sent, must include 2-10 \
2681
+ items.
2682
+
2683
+ :param caption: Audio caption, 0-1024 characters after entities parsing.
2684
+
2685
+ :param parse_mode: Mode for parsing entities in the audio caption. See formatting options \
2686
+ for more details.
2687
+
2688
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2689
+ which can be specified instead of parse_mode.
2690
+
2691
+ :param disable_notification: Sends messages silently. Users will receive a notification with no sound. \
2692
+
2693
+ :param protect_content: Protects the contents of the sent messages from forwarding and saving. \
2694
+
2695
+ :param reply_parameters: Description of the message to reply to."""
2696
+
2697
+ params = get_params(locals())
2698
+ params.setdefault("reply_parameters", {})
2699
+ return await self.answer_media_group(**params)
2700
+
2701
+ @shortcut(
2702
+ "send_location",
2703
+ executor=execute_method_reply,
2704
+ custom_params={"reply_parameters", "message_thread_id"},
2705
+ )
2706
+ async def reply_location(
2707
+ self,
2708
+ latitude: float,
2709
+ longitude: float,
2710
+ chat_id: Option[int | str] | int | str = Nothing,
2711
+ message_thread_id: Option[int] | int = Nothing,
2712
+ horizontal_accuracy: Option[float] | float = Nothing,
2713
+ heading: Option[int] | int = Nothing,
2714
+ live_period: Option[int] | int = Nothing,
2715
+ proximity_alert_radius: Option[int] | int = Nothing,
2716
+ disable_notification: Option[bool] | bool = Nothing,
2717
+ protect_content: Option[bool] | bool = Nothing,
2718
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2719
+ | ReplyParameters
2720
+ | dict[str, typing.Any] = Nothing,
2721
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2722
+ **other: typing.Any,
2723
+ ) -> Result[MessageCute, APIError]:
2724
+ """Shortcut `API.send_location()`, see the [documentation](https://core.telegram.org/bots/api#sendlocation)
2725
+
2726
+ Use this method to send a reply to a message with point on the map. On success, the sent Message is returned.
2727
+
2728
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2729
+ (in the format @channelusername).
2730
+
2731
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2732
+ forum supergroups only.
2733
+
2734
+ :param latitude: Latitude of the location.
2735
+
2736
+ :param longitude: Longitude of the location.
2737
+
2738
+ :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500. \
2739
+
2740
+ :param live_period: Period in seconds for which the location will be updated (see Live Locations, \
2741
+ should be between 60 and 86400.
2742
+
2743
+ :param heading: For live locations, a direction in which the user is moving, in degrees. \
2744
+ Must be between 1 and 360 if specified.
2745
+
2746
+ :param proximity_alert_radius: For live locations, a maximum distance for proximity alerts about approaching \
2747
+ another chat member, in meters. Must be between 1 and 100000 if specified. \
2748
+
2749
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2750
+
2751
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2752
+
2753
+ :param reply_parameters: Description of the message to reply to.
2754
+
2755
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2756
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2757
+ or to force a reply from the user."""
2758
+
2759
+ ...
2760
+
2761
+ @shortcut(
2762
+ "send_contact",
2763
+ executor=execute_method_reply,
2764
+ custom_params={"reply_parameters", "message_thread_id"},
2765
+ )
2766
+ async def reply_contact(
2767
+ self,
2768
+ phone_number: str,
2769
+ first_name: str,
2770
+ last_name: Option[str] | str = Nothing,
2771
+ vcard: Option[str] | str = Nothing,
2772
+ chat_id: Option[int | str] | int | str = Nothing,
2773
+ message_thread_id: Option[int] | int = Nothing,
2774
+ disable_notification: Option[bool] | bool = Nothing,
2775
+ protect_content: Option[bool] | bool = Nothing,
2776
+ reply_parameters: Option[ReplyParameters | dict[str, typing.Any]]
2777
+ | ReplyParameters
2778
+ | dict[str, typing.Any] = Nothing,
2779
+ reply_markup: Option[ReplyMarkup] | ReplyMarkup = Nothing,
2780
+ **other: typing.Any,
2781
+ ) -> Result[MessageCute, APIError]:
2782
+ """Shortcut `API.send_contact()`, see the [documentation](https://core.telegram.org/bots/api#sendcontact)
2783
+
2784
+ Use this method to send a reply to a message with phone contacts. On success, the sent Message is returned.
2785
+
2786
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2787
+ (in the format @channelusername).
2788
+
2789
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2790
+ forum supergroups only.
2791
+
2792
+ :param phone_number: Contact's phone number.
2793
+
2794
+ :param first_name: Contact's first name.
2795
+
2796
+ :param last_name: Contact's last name.
2797
+
2798
+ :param vcard: Additional data about the contact in the form of a vCard, 0-2048 bytes.
2799
+
2800
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
2801
+
2802
+ :param protect_content: Protects the contents of the sent message from forwarding and saving.
2803
+
2804
+ :param reply_parameters: Description of the message to reply to.
2805
+
2806
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline \
2807
+ keyboard, custom reply keyboard, instructions to remove reply keyboard \
2808
+ or to force a reply from the user."""
2809
+
2810
+ ...
2811
+
2812
+ @shortcut(
2813
+ "edit_message_live_location",
2814
+ executor=execute_method_edit,
2815
+ custom_params={"message_thread_id"},
2816
+ )
2817
+ async def edit_live_location(
2818
+ self,
2819
+ latitude: float,
2820
+ longitude: float,
2821
+ chat_id: Option[int | str] | int | str = Nothing,
2822
+ message_id: Option[int] | int = Nothing,
2823
+ message_thread_id: Option[int] | int = Nothing,
2824
+ horizontal_accuracy: Option[float] | float = Nothing,
2825
+ heading: Option[int] | int = Nothing,
2826
+ proximity_alert_radius: Option[int] | int = Nothing,
2827
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
2828
+ **other: typing.Any,
2829
+ ) -> Result[Variative[MessageCute, bool], APIError]:
2830
+ """Shortcut `API.edit_message_live_location()`, see the [documentation](https://core.telegram.org/bots/api#editmessagelivelocation)
2831
+
2832
+ Use this method to edit live location messages. A location can be edited
2833
+ until its live_period expires or editing is explicitly disabled by a call
2834
+ to stopMessageLiveLocation. On success, if the edited message is not an
2835
+ inline message, the edited Message is returned, otherwise True is returned.
2836
+
2837
+ :param chat_id: Required if inline_message_id is not specified. Unique identifier for \
2838
+ the target chat or username of the target channel (in the format @channelusername). \
2839
+
2840
+ :param message_id: Required if inline_message_id is not specified. Identifier of the message \
2841
+ to edit.
2842
+
2843
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2844
+ forum supergroups only.
2845
+
2846
+ :param latitude: Latitude of new location.
2847
+
2848
+ :param longitude: Longitude of new location.
2849
+
2850
+ :param horizontal_accuracy: The radius of uncertainty for the location, measured in meters; 0-1500. \
2851
+
2852
+ :param heading: Direction in which the user is moving, in degrees. Must be between 1 and 360 \
2853
+ if specified.
2854
+
2855
+ :param proximity_alert_radius: The maximum distance for proximity alerts about approaching another chat \
2856
+ member, in meters. Must be between 1 and 100000 if specified.
2857
+
2858
+ :param reply_markup: A JSON-serialized object for a new inline keyboard."""
2859
+
2860
+ ...
2861
+
2862
+ @shortcut(
2863
+ "edit_message_caption",
2864
+ executor=execute_method_edit,
2865
+ custom_params={"message_thread_id"},
2866
+ )
2867
+ async def edit_caption(
2868
+ self,
2869
+ caption: Option[str] | str,
2870
+ chat_id: Option[int | str] | int | str = Nothing,
2871
+ message_id: Option[int] | int = Nothing,
2872
+ message_thread_id: int | Option[int] = Nothing,
2873
+ parse_mode: Option[str] | str = Nothing,
2874
+ caption_entities: Option[list[MessageEntity]] | list[MessageEntity] = Nothing,
2875
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
2876
+ **other: typing.Any,
2877
+ ) -> Result[Variative[MessageCute, bool], APIError]:
2878
+ """Shortcut `API.edit_message_caption()`, see the [documentation](https://core.telegram.org/bots/api#editmessagecaption)
2879
+
2880
+ Use this method to edit captions of messages. On success, if the edited message
2881
+ is not an inline message, the edited Message is returned, otherwise True
2882
+ is returned.
2883
+
2884
+ :param chat_id: Required if inline_message_id is not specified. Unique identifier for \
2885
+ the target chat or username of the target channel (in the format @channelusername). \
2886
+
2887
+ :param message_id: Required if inline_message_id is not specified. Identifier of the message \
2888
+ to edit.
2889
+
2890
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2891
+ forum supergroups only.
2892
+
2893
+ :param caption: New caption of the message, 0-1024 characters after entities parsing. \
2894
+
2895
+ :param parse_mode: Mode for parsing entities in the message caption. See formatting options \
2896
+ for more details.
2897
+
2898
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2899
+ which can be specified instead of parse_mode.
2900
+
2901
+ :param reply_markup: A JSON-serialized object for an inline keyboard."""
2902
+
2903
+ ...
2904
+
2905
+ @shortcut(
2906
+ "edit_message_media",
2907
+ custom_params={"media", "type", "message_thread_id", "caption", "parse_mode", "caption_entities"},
2908
+ )
2909
+ async def edit_media(
2910
+ self,
2911
+ media: str | InputFile | InputMedia,
2912
+ type: MediaType | Option[MediaType] = Nothing,
2913
+ caption: Option[str] | str = Nothing,
2914
+ parse_mode: Option[str] | str = Nothing,
2915
+ caption_entities: Option[list[MessageEntity]] | list[MessageEntity] = Nothing,
2916
+ chat_id: Option[int | str] | int | str = Nothing,
2917
+ message_id: Option[int] | int = Nothing,
2918
+ message_thread_id: Option[int] | int = Nothing,
2919
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
2920
+ **other: typing.Any,
2921
+ ) -> Result[Variative[MessageCute, bool], APIError]:
2922
+ """Shortcut `API.edit_message_media()`, see the [documentation](https://core.telegram.org/bots/api#editmessagemedia)
2923
+
2924
+ Use this method to edit animation, audio, document, photo, or video messages.
2925
+ If a message is part of a message album, then it can be edited only to an audio
2926
+ for audio albums, only to a document for document albums and to a photo or
2927
+ a video otherwise. When an inline message is edited, a new file can't be uploaded;
2928
+ use a previously uploaded file via its file_id or specify a URL. On success,
2929
+ if the edited message is not an inline message, the edited Message is returned,
2930
+ otherwise True is returned.
2931
+
2932
+ :param chat_id: Required if inline_message_id is not specified. Unique identifier for \
2933
+ the target chat or username of the target channel (in the format @channelusername). \
2934
+
2935
+ :param message_id: Required if inline_message_id is not specified. Identifier of the message \
2936
+ to edit.
2937
+
2938
+ :param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
2939
+ forum supergroups only.
2940
+
2941
+ :param media: A JSON-serialized object for a new media content of the message.
2942
+
2943
+ :param caption: Audio caption, 0-1024 characters after entities parsing.
2944
+
2945
+ :param parse_mode: Mode for parsing entities in the audio caption. See formatting options \
2946
+ for more details.
2947
+
2948
+ :param caption_entities: A JSON-serialized list of special entities that appear in the caption, \
2949
+ which can be specified instead of parse_mode.
2950
+
2951
+ :param type: Required if media is not an `str | InputMedia` object. Type of the media, \
2952
+ must be one of `photo`, `video`, `animation`, `audio`, `document`.
2953
+
2954
+ :param reply_markup: A JSON-serialized object for a new inline keyboard."""
2955
+
2956
+ params = get_params(locals())
2957
+
2958
+ if not isinstance(media, InputMedia):
2959
+ assert (
2960
+ type
2961
+ ), "parameter 'type' is required, because 'media' is not an 'InputMedia' object."
2962
+ params["media"] = input_media(
2963
+ params.pop("type"),
2964
+ media,
2965
+ caption=caption,
2966
+ caption_entities=caption_entities,
2967
+ parse_mode=parse_mode,
2968
+ )
2969
+
2970
+ return await execute_method_edit(self, "edit_message_media", params)
2971
+
2972
+ @shortcut(
2973
+ "edit_message_reply_markup",
2974
+ executor=execute_method_edit,
2975
+ custom_params={"message_thread_id"},
2976
+ )
2977
+ async def edit_reply_markup(
2978
+ self,
2979
+ chat_id: Option[int | str] | int | str = Nothing,
2980
+ message_id: Option[int] | int = Nothing,
2981
+ message_thread_id: Option[int] | int = Nothing,
2982
+ reply_markup: Option[InlineKeyboardMarkup] | InlineKeyboardMarkup = Nothing,
2983
+ **other: typing.Any,
2984
+ ) -> Result[Variative[MessageCute, bool], APIError]:
2985
+ """Shortcut `API.edit_message_reply_markup()`, see the [documentation](https://core.telegram.org/bots/api#editmessagereplymarkup)
2986
+
2987
+ Use this method to edit only the reply markup of messages. On success, if
2988
+ the edited message is not an inline message, the edited Message is returned,
2989
+ otherwise True is returned.
2990
+
2991
+ :param chat_id: Required if inline_message_id is not specified. Unique identifier for \
2992
+ the target chat or username of the target channel (in the format @channelusername). \
2993
+
2994
+ :param message_id: Required if inline_message_id is not specified. Identifier of the message \
2995
+ to edit.
2996
+
2997
+ :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the \
2998
+ inline message.
2999
+
3000
+ :param reply_markup: A JSON-serialized object for an inline keyboard."""
3001
+
3002
+ ...
191
3003
 
192
3004
 
193
- __all__ = ("MessageCute", "get_entity_value")
3005
+ __all__ = ("MessageCute",)