botapi-py 1.5.9__tar.gz → 1.5.11__tar.gz
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.
- {botapi_py-1.5.9 → botapi_py-1.5.11}/PKG-INFO +1 -1
- {botapi_py-1.5.9 → botapi_py-1.5.11}/pyproject.toml +1 -1
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/__init__.py +4 -4
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/__init__.pyi +4 -4
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/bot.py +246 -246
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/core.py +105 -105
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/dispatchers/__init__.py +10 -10
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/dispatchers/__init__.pyi +10 -10
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/dispatchers/common.py +62 -62
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/dispatchers/get_updates_handler.py +199 -199
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/dispatchers/redis_pubsub_handler.py +242 -242
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/enums.py +203 -202
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/errors.py +33 -33
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/internals.py +11 -11
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/methods.py +5444 -5051
- {botapi_py-1.5.9 → botapi_py-1.5.11}/src/botapi/types.py +6161 -5107
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from . import enums, errors, types, dispatchers
|
|
2
|
-
from .bot import Bot
|
|
3
|
-
|
|
4
|
-
__all__ = ['Bot', 'types', 'enums', 'errors', 'dispatchers']
|
|
1
|
+
from . import enums, errors, types, dispatchers
|
|
2
|
+
from .bot import Bot
|
|
3
|
+
|
|
4
|
+
__all__ = ['Bot', 'types', 'enums', 'errors', 'dispatchers']
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from . import enums, errors, types, dispatchers
|
|
2
|
-
from .bot import Bot
|
|
3
|
-
|
|
4
|
-
__all__ = ['Bot', 'types', 'enums', 'errors', 'dispatchers']
|
|
1
|
+
from . import enums, errors, types, dispatchers
|
|
2
|
+
from .bot import Bot
|
|
3
|
+
|
|
4
|
+
__all__ = ['Bot', 'types', 'enums', 'errors', 'dispatchers']
|
|
@@ -1,246 +1,246 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Optional, Union, List
|
|
4
|
-
|
|
5
|
-
from . import enums
|
|
6
|
-
from . import types
|
|
7
|
-
from . import methods
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Bot(methods.Methods):
|
|
11
|
-
'''
|
|
12
|
-
A (very lightweight) instance of a Telegram Bot.
|
|
13
|
-
Use this to call API methods and shortcut bound methods.
|
|
14
|
-
|
|
15
|
-
_Remember to pass an existing `httpx.AsyncClient` instance
|
|
16
|
-
to avoid significant performance degradation in production._
|
|
17
|
-
'''
|
|
18
|
-
|
|
19
|
-
async def send_media(
|
|
20
|
-
self,
|
|
21
|
-
chat_id: Union[int, str],
|
|
22
|
-
media: Union[types.InputFile, str, None],
|
|
23
|
-
file_type: Optional[enums.MediaType | str],
|
|
24
|
-
caption: Optional[str] = None,
|
|
25
|
-
parse_mode: Optional[Union[str, enums.ParseMode]] = None,
|
|
26
|
-
caption_entities: Optional[List[types.MessageEntity]] = None,
|
|
27
|
-
show_caption_above_media: Optional[bool] = None,
|
|
28
|
-
has_spoiler: Optional[bool] = None,
|
|
29
|
-
disable_notification: Optional[bool] = None,
|
|
30
|
-
protect_content: Optional[bool] = None,
|
|
31
|
-
reply_parameters: Optional[types.ReplyParameters] = None,
|
|
32
|
-
reply_markup: Optional[Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply]] = None,
|
|
33
|
-
message_effect_id: Optional[str] = None,
|
|
34
|
-
allow_paid_broadcast: Optional[bool] = None,
|
|
35
|
-
business_connection_id: Optional[str] = None,
|
|
36
|
-
message_thread_id: Optional[int] = None,
|
|
37
|
-
disable_content_type_detection: Optional[bool] = None, # Documents only
|
|
38
|
-
) -> types.Message:
|
|
39
|
-
'''
|
|
40
|
-
Shortcut method that sends common types of media by automatically routing to the correct `send_<type>` method.
|
|
41
|
-
Also supports `send_message` for plaintext-only messages for convenience.
|
|
42
|
-
|
|
43
|
-
:param chat_id: Unique identifier for the target chat or username of the target channel.
|
|
44
|
-
:param media: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
|
|
45
|
-
:param file_type: The type of media to send. Use `enums.MediaType`.
|
|
46
|
-
:param caption: Media caption, 0-1024 characters.
|
|
47
|
-
:param parse_mode: Mode for parsing entities in the media caption.
|
|
48
|
-
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode.
|
|
49
|
-
:param show_caption_above_media: Pass True, if the caption must be shown above the message media.
|
|
50
|
-
:param has_spoiler: Pass True if the media needs to be covered with a spoiler animation.
|
|
51
|
-
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
|
52
|
-
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
53
|
-
:param reply_parameters: Description of the message to reply to.
|
|
54
|
-
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
|
|
55
|
-
:param message_effect_id: Unique identifier of the message effect to be added to the message.
|
|
56
|
-
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
|
|
57
|
-
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent.
|
|
58
|
-
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
|
|
59
|
-
:param disable_content_type_detection: Disables automatic server-side content type detection.
|
|
60
|
-
:return: On success, the sent Message is returned.
|
|
61
|
-
'''
|
|
62
|
-
|
|
63
|
-
# Plain text message
|
|
64
|
-
if not media or not file_type:
|
|
65
|
-
if not caption:
|
|
66
|
-
raise ValueError('Either media or caption must be provided.')
|
|
67
|
-
|
|
68
|
-
return await self.send_message(
|
|
69
|
-
chat_id=chat_id,
|
|
70
|
-
# media=media,
|
|
71
|
-
text=caption,
|
|
72
|
-
parse_mode=parse_mode,
|
|
73
|
-
entities=caption_entities,
|
|
74
|
-
disable_notification=disable_notification,
|
|
75
|
-
protect_content=protect_content,
|
|
76
|
-
reply_parameters=reply_parameters,
|
|
77
|
-
reply_markup=reply_markup,
|
|
78
|
-
message_effect_id=message_effect_id,
|
|
79
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
80
|
-
business_connection_id=business_connection_id,
|
|
81
|
-
message_thread_id=message_thread_id,
|
|
82
|
-
# has_spoiler=has_spoiler,
|
|
83
|
-
# show_caption_above_media=show_caption_above_media
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
match file_type:
|
|
87
|
-
|
|
88
|
-
case enums.MediaType.PHOTO:
|
|
89
|
-
return await self.send_photo(
|
|
90
|
-
chat_id=chat_id,
|
|
91
|
-
photo=media,
|
|
92
|
-
caption=caption,
|
|
93
|
-
parse_mode=parse_mode,
|
|
94
|
-
caption_entities=caption_entities,
|
|
95
|
-
disable_notification=disable_notification,
|
|
96
|
-
protect_content=protect_content,
|
|
97
|
-
reply_parameters=reply_parameters,
|
|
98
|
-
reply_markup=reply_markup,
|
|
99
|
-
message_effect_id=message_effect_id,
|
|
100
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
101
|
-
business_connection_id=business_connection_id,
|
|
102
|
-
message_thread_id=message_thread_id,
|
|
103
|
-
has_spoiler=has_spoiler,
|
|
104
|
-
show_caption_above_media=show_caption_above_media
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
case enums.MediaType.VIDEO:
|
|
108
|
-
return await self.send_video(
|
|
109
|
-
chat_id=chat_id,
|
|
110
|
-
video=media,
|
|
111
|
-
caption=caption,
|
|
112
|
-
parse_mode=parse_mode,
|
|
113
|
-
caption_entities=caption_entities,
|
|
114
|
-
disable_notification=disable_notification,
|
|
115
|
-
protect_content=protect_content,
|
|
116
|
-
reply_parameters=reply_parameters,
|
|
117
|
-
reply_markup=reply_markup,
|
|
118
|
-
message_effect_id=message_effect_id,
|
|
119
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
120
|
-
business_connection_id=business_connection_id,
|
|
121
|
-
message_thread_id=message_thread_id,
|
|
122
|
-
has_spoiler=has_spoiler,
|
|
123
|
-
show_caption_above_media=show_caption_above_media
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
case enums.MediaType.ANIMATION:
|
|
127
|
-
return await self.send_animation(
|
|
128
|
-
chat_id=chat_id,
|
|
129
|
-
animation=media,
|
|
130
|
-
caption=caption,
|
|
131
|
-
parse_mode=parse_mode,
|
|
132
|
-
caption_entities=caption_entities,
|
|
133
|
-
disable_notification=disable_notification,
|
|
134
|
-
protect_content=protect_content,
|
|
135
|
-
reply_parameters=reply_parameters,
|
|
136
|
-
reply_markup=reply_markup,
|
|
137
|
-
message_effect_id=message_effect_id,
|
|
138
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
139
|
-
business_connection_id=business_connection_id,
|
|
140
|
-
message_thread_id=message_thread_id,
|
|
141
|
-
has_spoiler=has_spoiler,
|
|
142
|
-
show_caption_above_media=show_caption_above_media
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
case enums.MediaType.AUDIO:
|
|
146
|
-
return await self.send_audio(
|
|
147
|
-
chat_id=chat_id,
|
|
148
|
-
audio=media,
|
|
149
|
-
caption=caption,
|
|
150
|
-
parse_mode=parse_mode,
|
|
151
|
-
caption_entities=caption_entities,
|
|
152
|
-
disable_notification=disable_notification,
|
|
153
|
-
protect_content=protect_content,
|
|
154
|
-
reply_parameters=reply_parameters,
|
|
155
|
-
reply_markup=reply_markup,
|
|
156
|
-
message_effect_id=message_effect_id,
|
|
157
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
158
|
-
business_connection_id=business_connection_id,
|
|
159
|
-
message_thread_id=message_thread_id,
|
|
160
|
-
# has_spoiler=has_spoiler,
|
|
161
|
-
# show_caption_above_media=show_caption_above_media
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
case enums.MediaType.DOCUMENT:
|
|
165
|
-
return await self.send_document(
|
|
166
|
-
chat_id=chat_id,
|
|
167
|
-
document=media,
|
|
168
|
-
caption=caption,
|
|
169
|
-
parse_mode=parse_mode,
|
|
170
|
-
caption_entities=caption_entities,
|
|
171
|
-
disable_notification=disable_notification,
|
|
172
|
-
protect_content=protect_content,
|
|
173
|
-
reply_parameters=reply_parameters,
|
|
174
|
-
reply_markup=reply_markup,
|
|
175
|
-
message_effect_id=message_effect_id,
|
|
176
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
177
|
-
business_connection_id=business_connection_id,
|
|
178
|
-
message_thread_id=message_thread_id,
|
|
179
|
-
# has_spoiler=has_spoiler,
|
|
180
|
-
# show_caption_above_media=show_caption_above_media,
|
|
181
|
-
disable_content_type_detection=disable_content_type_detection
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
case enums.MediaType.VOICE:
|
|
185
|
-
return await self.send_voice(
|
|
186
|
-
chat_id=chat_id,
|
|
187
|
-
voice=media,
|
|
188
|
-
caption=caption,
|
|
189
|
-
parse_mode=parse_mode,
|
|
190
|
-
caption_entities=caption_entities,
|
|
191
|
-
disable_notification=disable_notification,
|
|
192
|
-
protect_content=protect_content,
|
|
193
|
-
reply_parameters=reply_parameters,
|
|
194
|
-
reply_markup=reply_markup,
|
|
195
|
-
message_effect_id=message_effect_id,
|
|
196
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
197
|
-
business_connection_id=business_connection_id,
|
|
198
|
-
message_thread_id=message_thread_id,
|
|
199
|
-
# has_spoiler=has_spoiler,
|
|
200
|
-
# show_caption_above_media=show_caption_above_media
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
case enums.MediaType.VIDEO_NOTE:
|
|
204
|
-
return await self.send_video_note(
|
|
205
|
-
chat_id=chat_id,
|
|
206
|
-
video_note=media,
|
|
207
|
-
# caption=caption,
|
|
208
|
-
# parse_mode=parse_mode,
|
|
209
|
-
# caption_entities=caption_entities,
|
|
210
|
-
disable_notification=disable_notification,
|
|
211
|
-
protect_content=protect_content,
|
|
212
|
-
reply_parameters=reply_parameters,
|
|
213
|
-
reply_markup=reply_markup,
|
|
214
|
-
message_effect_id=message_effect_id,
|
|
215
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
216
|
-
business_connection_id=business_connection_id,
|
|
217
|
-
message_thread_id=message_thread_id,
|
|
218
|
-
# has_spoiler=has_spoiler,
|
|
219
|
-
# show_caption_above_media=show_caption_above_media
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
case enums.MediaType.STICKER:
|
|
223
|
-
return await self.send_sticker(
|
|
224
|
-
chat_id=chat_id,
|
|
225
|
-
sticker=media,
|
|
226
|
-
# caption=caption,
|
|
227
|
-
# parse_mode=parse_mode,
|
|
228
|
-
# caption_entities=caption_entities,
|
|
229
|
-
disable_notification=disable_notification,
|
|
230
|
-
protect_content=protect_content,
|
|
231
|
-
reply_parameters=reply_parameters,
|
|
232
|
-
reply_markup=reply_markup,
|
|
233
|
-
message_effect_id=message_effect_id,
|
|
234
|
-
allow_paid_broadcast=allow_paid_broadcast,
|
|
235
|
-
business_connection_id=business_connection_id,
|
|
236
|
-
message_thread_id=message_thread_id,
|
|
237
|
-
# has_spoiler=has_spoiler,
|
|
238
|
-
# show_caption_above_media=show_caption_above_media
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
case enums.MediaType.STORY | enums.MediaType.PAID_MEDIA:
|
|
242
|
-
raise ValueError(f'Unsupported media type: {file_type}')
|
|
243
|
-
|
|
244
|
-
case _:
|
|
245
|
-
raise ValueError(f'Unknown media type: {file_type}')
|
|
246
|
-
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Union, List
|
|
4
|
+
|
|
5
|
+
from . import enums
|
|
6
|
+
from . import types
|
|
7
|
+
from . import methods
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Bot(methods.Methods):
|
|
11
|
+
'''
|
|
12
|
+
A (very lightweight) instance of a Telegram Bot.
|
|
13
|
+
Use this to call API methods and shortcut bound methods.
|
|
14
|
+
|
|
15
|
+
_Remember to pass an existing `httpx.AsyncClient` instance
|
|
16
|
+
to avoid significant performance degradation in production._
|
|
17
|
+
'''
|
|
18
|
+
|
|
19
|
+
async def send_media(
|
|
20
|
+
self,
|
|
21
|
+
chat_id: Union[int, str],
|
|
22
|
+
media: Union[types.InputFile, str, None],
|
|
23
|
+
file_type: Optional[enums.MediaType | str],
|
|
24
|
+
caption: Optional[str] = None,
|
|
25
|
+
parse_mode: Optional[Union[str, enums.ParseMode]] = None,
|
|
26
|
+
caption_entities: Optional[List[types.MessageEntity]] = None,
|
|
27
|
+
show_caption_above_media: Optional[bool] = None,
|
|
28
|
+
has_spoiler: Optional[bool] = None,
|
|
29
|
+
disable_notification: Optional[bool] = None,
|
|
30
|
+
protect_content: Optional[bool] = None,
|
|
31
|
+
reply_parameters: Optional[types.ReplyParameters] = None,
|
|
32
|
+
reply_markup: Optional[Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply]] = None,
|
|
33
|
+
message_effect_id: Optional[str] = None,
|
|
34
|
+
allow_paid_broadcast: Optional[bool] = None,
|
|
35
|
+
business_connection_id: Optional[str] = None,
|
|
36
|
+
message_thread_id: Optional[int] = None,
|
|
37
|
+
disable_content_type_detection: Optional[bool] = None, # Documents only
|
|
38
|
+
) -> types.Message:
|
|
39
|
+
'''
|
|
40
|
+
Shortcut method that sends common types of media by automatically routing to the correct `send_<type>` method.
|
|
41
|
+
Also supports `send_message` for plaintext-only messages for convenience.
|
|
42
|
+
|
|
43
|
+
:param chat_id: Unique identifier for the target chat or username of the target channel.
|
|
44
|
+
:param media: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
|
|
45
|
+
:param file_type: The type of media to send. Use `enums.MediaType`.
|
|
46
|
+
:param caption: Media caption, 0-1024 characters.
|
|
47
|
+
:param parse_mode: Mode for parsing entities in the media caption.
|
|
48
|
+
:param caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode.
|
|
49
|
+
:param show_caption_above_media: Pass True, if the caption must be shown above the message media.
|
|
50
|
+
:param has_spoiler: Pass True if the media needs to be covered with a spoiler animation.
|
|
51
|
+
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
|
52
|
+
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
53
|
+
:param reply_parameters: Description of the message to reply to.
|
|
54
|
+
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
|
|
55
|
+
:param message_effect_id: Unique identifier of the message effect to be added to the message.
|
|
56
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
|
|
57
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent.
|
|
58
|
+
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
|
|
59
|
+
:param disable_content_type_detection: Disables automatic server-side content type detection.
|
|
60
|
+
:return: On success, the sent Message is returned.
|
|
61
|
+
'''
|
|
62
|
+
|
|
63
|
+
# Plain text message
|
|
64
|
+
if not media or not file_type:
|
|
65
|
+
if not caption:
|
|
66
|
+
raise ValueError('Either media or caption must be provided.')
|
|
67
|
+
|
|
68
|
+
return await self.send_message(
|
|
69
|
+
chat_id=chat_id,
|
|
70
|
+
# media=media,
|
|
71
|
+
text=caption,
|
|
72
|
+
parse_mode=parse_mode,
|
|
73
|
+
entities=caption_entities,
|
|
74
|
+
disable_notification=disable_notification,
|
|
75
|
+
protect_content=protect_content,
|
|
76
|
+
reply_parameters=reply_parameters,
|
|
77
|
+
reply_markup=reply_markup,
|
|
78
|
+
message_effect_id=message_effect_id,
|
|
79
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
80
|
+
business_connection_id=business_connection_id,
|
|
81
|
+
message_thread_id=message_thread_id,
|
|
82
|
+
# has_spoiler=has_spoiler,
|
|
83
|
+
# show_caption_above_media=show_caption_above_media
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
match file_type:
|
|
87
|
+
|
|
88
|
+
case enums.MediaType.PHOTO:
|
|
89
|
+
return await self.send_photo(
|
|
90
|
+
chat_id=chat_id,
|
|
91
|
+
photo=media,
|
|
92
|
+
caption=caption,
|
|
93
|
+
parse_mode=parse_mode,
|
|
94
|
+
caption_entities=caption_entities,
|
|
95
|
+
disable_notification=disable_notification,
|
|
96
|
+
protect_content=protect_content,
|
|
97
|
+
reply_parameters=reply_parameters,
|
|
98
|
+
reply_markup=reply_markup,
|
|
99
|
+
message_effect_id=message_effect_id,
|
|
100
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
101
|
+
business_connection_id=business_connection_id,
|
|
102
|
+
message_thread_id=message_thread_id,
|
|
103
|
+
has_spoiler=has_spoiler,
|
|
104
|
+
show_caption_above_media=show_caption_above_media
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
case enums.MediaType.VIDEO:
|
|
108
|
+
return await self.send_video(
|
|
109
|
+
chat_id=chat_id,
|
|
110
|
+
video=media,
|
|
111
|
+
caption=caption,
|
|
112
|
+
parse_mode=parse_mode,
|
|
113
|
+
caption_entities=caption_entities,
|
|
114
|
+
disable_notification=disable_notification,
|
|
115
|
+
protect_content=protect_content,
|
|
116
|
+
reply_parameters=reply_parameters,
|
|
117
|
+
reply_markup=reply_markup,
|
|
118
|
+
message_effect_id=message_effect_id,
|
|
119
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
120
|
+
business_connection_id=business_connection_id,
|
|
121
|
+
message_thread_id=message_thread_id,
|
|
122
|
+
has_spoiler=has_spoiler,
|
|
123
|
+
show_caption_above_media=show_caption_above_media
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
case enums.MediaType.ANIMATION:
|
|
127
|
+
return await self.send_animation(
|
|
128
|
+
chat_id=chat_id,
|
|
129
|
+
animation=media,
|
|
130
|
+
caption=caption,
|
|
131
|
+
parse_mode=parse_mode,
|
|
132
|
+
caption_entities=caption_entities,
|
|
133
|
+
disable_notification=disable_notification,
|
|
134
|
+
protect_content=protect_content,
|
|
135
|
+
reply_parameters=reply_parameters,
|
|
136
|
+
reply_markup=reply_markup,
|
|
137
|
+
message_effect_id=message_effect_id,
|
|
138
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
139
|
+
business_connection_id=business_connection_id,
|
|
140
|
+
message_thread_id=message_thread_id,
|
|
141
|
+
has_spoiler=has_spoiler,
|
|
142
|
+
show_caption_above_media=show_caption_above_media
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
case enums.MediaType.AUDIO:
|
|
146
|
+
return await self.send_audio(
|
|
147
|
+
chat_id=chat_id,
|
|
148
|
+
audio=media,
|
|
149
|
+
caption=caption,
|
|
150
|
+
parse_mode=parse_mode,
|
|
151
|
+
caption_entities=caption_entities,
|
|
152
|
+
disable_notification=disable_notification,
|
|
153
|
+
protect_content=protect_content,
|
|
154
|
+
reply_parameters=reply_parameters,
|
|
155
|
+
reply_markup=reply_markup,
|
|
156
|
+
message_effect_id=message_effect_id,
|
|
157
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
158
|
+
business_connection_id=business_connection_id,
|
|
159
|
+
message_thread_id=message_thread_id,
|
|
160
|
+
# has_spoiler=has_spoiler,
|
|
161
|
+
# show_caption_above_media=show_caption_above_media
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
case enums.MediaType.DOCUMENT:
|
|
165
|
+
return await self.send_document(
|
|
166
|
+
chat_id=chat_id,
|
|
167
|
+
document=media,
|
|
168
|
+
caption=caption,
|
|
169
|
+
parse_mode=parse_mode,
|
|
170
|
+
caption_entities=caption_entities,
|
|
171
|
+
disable_notification=disable_notification,
|
|
172
|
+
protect_content=protect_content,
|
|
173
|
+
reply_parameters=reply_parameters,
|
|
174
|
+
reply_markup=reply_markup,
|
|
175
|
+
message_effect_id=message_effect_id,
|
|
176
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
177
|
+
business_connection_id=business_connection_id,
|
|
178
|
+
message_thread_id=message_thread_id,
|
|
179
|
+
# has_spoiler=has_spoiler,
|
|
180
|
+
# show_caption_above_media=show_caption_above_media,
|
|
181
|
+
disable_content_type_detection=disable_content_type_detection
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
case enums.MediaType.VOICE:
|
|
185
|
+
return await self.send_voice(
|
|
186
|
+
chat_id=chat_id,
|
|
187
|
+
voice=media,
|
|
188
|
+
caption=caption,
|
|
189
|
+
parse_mode=parse_mode,
|
|
190
|
+
caption_entities=caption_entities,
|
|
191
|
+
disable_notification=disable_notification,
|
|
192
|
+
protect_content=protect_content,
|
|
193
|
+
reply_parameters=reply_parameters,
|
|
194
|
+
reply_markup=reply_markup,
|
|
195
|
+
message_effect_id=message_effect_id,
|
|
196
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
197
|
+
business_connection_id=business_connection_id,
|
|
198
|
+
message_thread_id=message_thread_id,
|
|
199
|
+
# has_spoiler=has_spoiler,
|
|
200
|
+
# show_caption_above_media=show_caption_above_media
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
case enums.MediaType.VIDEO_NOTE:
|
|
204
|
+
return await self.send_video_note(
|
|
205
|
+
chat_id=chat_id,
|
|
206
|
+
video_note=media,
|
|
207
|
+
# caption=caption,
|
|
208
|
+
# parse_mode=parse_mode,
|
|
209
|
+
# caption_entities=caption_entities,
|
|
210
|
+
disable_notification=disable_notification,
|
|
211
|
+
protect_content=protect_content,
|
|
212
|
+
reply_parameters=reply_parameters,
|
|
213
|
+
reply_markup=reply_markup,
|
|
214
|
+
message_effect_id=message_effect_id,
|
|
215
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
216
|
+
business_connection_id=business_connection_id,
|
|
217
|
+
message_thread_id=message_thread_id,
|
|
218
|
+
# has_spoiler=has_spoiler,
|
|
219
|
+
# show_caption_above_media=show_caption_above_media
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
case enums.MediaType.STICKER:
|
|
223
|
+
return await self.send_sticker(
|
|
224
|
+
chat_id=chat_id,
|
|
225
|
+
sticker=media,
|
|
226
|
+
# caption=caption,
|
|
227
|
+
# parse_mode=parse_mode,
|
|
228
|
+
# caption_entities=caption_entities,
|
|
229
|
+
disable_notification=disable_notification,
|
|
230
|
+
protect_content=protect_content,
|
|
231
|
+
reply_parameters=reply_parameters,
|
|
232
|
+
reply_markup=reply_markup,
|
|
233
|
+
message_effect_id=message_effect_id,
|
|
234
|
+
allow_paid_broadcast=allow_paid_broadcast,
|
|
235
|
+
business_connection_id=business_connection_id,
|
|
236
|
+
message_thread_id=message_thread_id,
|
|
237
|
+
# has_spoiler=has_spoiler,
|
|
238
|
+
# show_caption_above_media=show_caption_above_media
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
case enums.MediaType.STORY | enums.MediaType.PAID_MEDIA:
|
|
242
|
+
raise ValueError(f'Unsupported media type: {file_type}')
|
|
243
|
+
|
|
244
|
+
case _:
|
|
245
|
+
raise ValueError(f'Unknown media type: {file_type}')
|
|
246
|
+
|