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