nicebot 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nicebot/__about__.py +1 -0
- nicebot/__init__.py +60 -0
- nicebot/_base.py +75 -0
- nicebot/api.py +1317 -0
- nicebot/bot.py +773 -0
- nicebot/broadcast.py +76 -0
- nicebot/cli.py +131 -0
- nicebot/client.py +223 -0
- nicebot/config.py +67 -0
- nicebot/context.py +820 -0
- nicebot/di.py +138 -0
- nicebot/errors.py +101 -0
- nicebot/features.py +509 -0
- nicebot/filters.py +140 -0
- nicebot/i18n.py +217 -0
- nicebot/keyboards.py +376 -0
- nicebot/logs.py +33 -0
- nicebot/menu.py +116 -0
- nicebot/orm/__init__.py +7 -0
- nicebot/orm/builtin.py +66 -0
- nicebot/orm/db.py +128 -0
- nicebot/orm/fields.py +274 -0
- nicebot/orm/model.py +414 -0
- nicebot/orm/mongo.py +228 -0
- nicebot/orm/query.py +232 -0
- nicebot/orm/sql.py +648 -0
- nicebot/pagination.py +98 -0
- nicebot/py.typed +0 -0
- nicebot/reload.py +66 -0
- nicebot/router.py +373 -0
- nicebot/scheduler.py +92 -0
- nicebot/server.py +224 -0
- nicebot/storage.py +173 -0
- nicebot/testing.py +422 -0
- nicebot/types.py +5327 -0
- nicebot/utils.py +231 -0
- nicebot/validators.py +315 -0
- nicebot-0.1.0.dist-info/METADATA +160 -0
- nicebot-0.1.0.dist-info/RECORD +42 -0
- nicebot-0.1.0.dist-info/WHEEL +4 -0
- nicebot-0.1.0.dist-info/entry_points.txt +2 -0
- nicebot-0.1.0.dist-info/licenses/LICENSE +21 -0
nicebot/api.py
ADDED
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
"""Telegram Bot API methods — AUTO-GENERATED by tools/gen_api.py. Do not edit."""
|
|
2
|
+
# fmt: off
|
|
3
|
+
# ruff: noqa
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Any, TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
from .types import * # noqa: F403
|
|
9
|
+
from .types import InputFile
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BotAPI:
|
|
13
|
+
"""Every Bot API method as a typed async Python method.
|
|
14
|
+
|
|
15
|
+
``await bot.send_message(chat_id, 'Salom')`` — snake_case names, keyword options.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
async def request(self, method: str, params: dict[str, Any], returns: Any = Any) -> Any: # pragma: no cover
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
|
|
21
|
+
async def get_updates(self, *, offset: int | None = None, limit: int | None = None, timeout: int | None = None, allowed_updates: list[str] | None = None) -> list[Update]:
|
|
22
|
+
"""Use this method to receive incoming updates using long polling (wiki).
|
|
23
|
+
|
|
24
|
+
https://core.telegram.org/bots/api#getupdates
|
|
25
|
+
"""
|
|
26
|
+
return await self.request("getUpdates", {"offset": offset, "limit": limit, "timeout": timeout, "allowed_updates": allowed_updates}, 'list[Update]')
|
|
27
|
+
|
|
28
|
+
async def set_webhook(self, url: str, *, certificate: InputFile | None = None, ip_address: str | None = None, max_connections: int | None = None, allowed_updates: list[str] | None = None, drop_pending_updates: bool | None = None, secret_token: str | None = None) -> bool:
|
|
29
|
+
"""Use this method to specify a URL and receive incoming updates via an outgoing webhook.
|
|
30
|
+
|
|
31
|
+
https://core.telegram.org/bots/api#setwebhook
|
|
32
|
+
"""
|
|
33
|
+
return await self.request("setWebhook", {"url": url, "certificate": certificate, "ip_address": ip_address, "max_connections": max_connections, "allowed_updates": allowed_updates, "drop_pending_updates": drop_pending_updates, "secret_token": secret_token}, 'bool')
|
|
34
|
+
|
|
35
|
+
async def delete_webhook(self, *, drop_pending_updates: bool | None = None) -> bool:
|
|
36
|
+
"""Use this method to remove webhook integration if you decide to switch back to getUpdates.
|
|
37
|
+
|
|
38
|
+
https://core.telegram.org/bots/api#deletewebhook
|
|
39
|
+
"""
|
|
40
|
+
return await self.request("deleteWebhook", {"drop_pending_updates": drop_pending_updates}, 'bool')
|
|
41
|
+
|
|
42
|
+
async def get_webhook_info(self) -> WebhookInfo:
|
|
43
|
+
"""Use this method to get current webhook status.
|
|
44
|
+
|
|
45
|
+
https://core.telegram.org/bots/api#getwebhookinfo
|
|
46
|
+
"""
|
|
47
|
+
return await self.request("getWebhookInfo", {}, 'WebhookInfo')
|
|
48
|
+
|
|
49
|
+
async def get_me(self) -> User:
|
|
50
|
+
"""A simple method for testing your bot's authentication token.
|
|
51
|
+
|
|
52
|
+
https://core.telegram.org/bots/api#getme
|
|
53
|
+
"""
|
|
54
|
+
return await self.request("getMe", {}, 'User')
|
|
55
|
+
|
|
56
|
+
async def log_out(self) -> bool:
|
|
57
|
+
"""Use this method to log out from the cloud Bot API server before launching the bot locally.
|
|
58
|
+
|
|
59
|
+
https://core.telegram.org/bots/api#logout
|
|
60
|
+
"""
|
|
61
|
+
return await self.request("logOut", {}, 'bool')
|
|
62
|
+
|
|
63
|
+
async def close(self) -> bool:
|
|
64
|
+
"""Use this method to close the bot instance before moving it from one local server to another.
|
|
65
|
+
|
|
66
|
+
https://core.telegram.org/bots/api#close
|
|
67
|
+
"""
|
|
68
|
+
return await self.request("close", {}, 'bool')
|
|
69
|
+
|
|
70
|
+
async def send_message(self, chat_id: int | str, text: str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, parse_mode: str | None = None, entities: list[MessageEntity] | None = None, link_preview_options: LinkPreviewOptions | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
71
|
+
"""Use this method to send text messages.
|
|
72
|
+
|
|
73
|
+
https://core.telegram.org/bots/api#sendmessage
|
|
74
|
+
"""
|
|
75
|
+
return await self.request("sendMessage", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "text": text, "parse_mode": parse_mode, "entities": entities, "link_preview_options": link_preview_options, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
76
|
+
|
|
77
|
+
async def forward_message(self, chat_id: int | str, from_chat_id: int | str, message_id: int, *, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, video_start_timestamp: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None) -> Message:
|
|
78
|
+
"""Use this method to forward messages of any kind.
|
|
79
|
+
|
|
80
|
+
https://core.telegram.org/bots/api#forwardmessage
|
|
81
|
+
"""
|
|
82
|
+
return await self.request("forwardMessage", {"chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "from_chat_id": from_chat_id, "video_start_timestamp": video_start_timestamp, "disable_notification": disable_notification, "protect_content": protect_content, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "message_id": message_id}, 'Message')
|
|
83
|
+
|
|
84
|
+
async def forward_messages(self, chat_id: int | str, from_chat_id: int | str, message_ids: list[int], *, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None) -> list[MessageId]:
|
|
85
|
+
"""Use this method to forward multiple messages of any kind.
|
|
86
|
+
|
|
87
|
+
https://core.telegram.org/bots/api#forwardmessages
|
|
88
|
+
"""
|
|
89
|
+
return await self.request("forwardMessages", {"chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "from_chat_id": from_chat_id, "message_ids": message_ids, "disable_notification": disable_notification, "protect_content": protect_content}, 'list[MessageId]')
|
|
90
|
+
|
|
91
|
+
async def copy_message(self, chat_id: int | str, from_chat_id: int | str, message_id: int, *, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, video_start_timestamp: int | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> MessageId:
|
|
92
|
+
"""Use this method to copy messages of any kind.
|
|
93
|
+
|
|
94
|
+
https://core.telegram.org/bots/api#copymessage
|
|
95
|
+
"""
|
|
96
|
+
return await self.request("copyMessage", {"chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "from_chat_id": from_chat_id, "message_id": message_id, "video_start_timestamp": video_start_timestamp, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'MessageId')
|
|
97
|
+
|
|
98
|
+
async def copy_messages(self, chat_id: int | str, from_chat_id: int | str, message_ids: list[int], *, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, remove_caption: bool | None = None) -> list[MessageId]:
|
|
99
|
+
"""Use this method to copy messages of any kind.
|
|
100
|
+
|
|
101
|
+
https://core.telegram.org/bots/api#copymessages
|
|
102
|
+
"""
|
|
103
|
+
return await self.request("copyMessages", {"chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "from_chat_id": from_chat_id, "message_ids": message_ids, "disable_notification": disable_notification, "protect_content": protect_content, "remove_caption": remove_caption}, 'list[MessageId]')
|
|
104
|
+
|
|
105
|
+
async def send_photo(self, chat_id: int | str, photo: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, has_spoiler: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
106
|
+
"""Use this method to send photos.
|
|
107
|
+
|
|
108
|
+
https://core.telegram.org/bots/api#sendphoto
|
|
109
|
+
"""
|
|
110
|
+
return await self.request("sendPhoto", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "photo": photo, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "has_spoiler": has_spoiler, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
111
|
+
|
|
112
|
+
async def send_live_photo(self, chat_id: int | str, live_photo: InputFile | str, photo: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, has_spoiler: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
113
|
+
"""Use this method to send live photos.
|
|
114
|
+
|
|
115
|
+
https://core.telegram.org/bots/api#sendlivephoto
|
|
116
|
+
"""
|
|
117
|
+
return await self.request("sendLivePhoto", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "live_photo": live_photo, "photo": photo, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "has_spoiler": has_spoiler, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
118
|
+
|
|
119
|
+
async def send_audio(self, chat_id: int | str, audio: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, duration: int | None = None, performer: str | None = None, title: str | None = None, thumbnail: InputFile | str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
120
|
+
"""Use this method to send audio files, if you want Telegram clients to display them in the music player.
|
|
121
|
+
|
|
122
|
+
https://core.telegram.org/bots/api#sendaudio
|
|
123
|
+
"""
|
|
124
|
+
return await self.request("sendAudio", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "audio": audio, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "duration": duration, "performer": performer, "title": title, "thumbnail": thumbnail, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
125
|
+
|
|
126
|
+
async def send_document(self, chat_id: int | str, document: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, thumbnail: InputFile | str | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, disable_content_type_detection: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
127
|
+
"""Use this method to send general files.
|
|
128
|
+
|
|
129
|
+
https://core.telegram.org/bots/api#senddocument
|
|
130
|
+
"""
|
|
131
|
+
return await self.request("sendDocument", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "document": document, "thumbnail": thumbnail, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "disable_content_type_detection": disable_content_type_detection, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
132
|
+
|
|
133
|
+
async def send_video(self, chat_id: int | str, video: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, duration: int | None = None, width: int | None = None, height: int | None = None, thumbnail: InputFile | str | None = None, cover: InputFile | str | None = None, start_timestamp: int | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, has_spoiler: bool | None = None, supports_streaming: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
134
|
+
"""Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).
|
|
135
|
+
|
|
136
|
+
https://core.telegram.org/bots/api#sendvideo
|
|
137
|
+
"""
|
|
138
|
+
return await self.request("sendVideo", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "video": video, "duration": duration, "width": width, "height": height, "thumbnail": thumbnail, "cover": cover, "start_timestamp": start_timestamp, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "has_spoiler": has_spoiler, "supports_streaming": supports_streaming, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
139
|
+
|
|
140
|
+
async def send_animation(self, chat_id: int | str, animation: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, duration: int | None = None, width: int | None = None, height: int | None = None, thumbnail: InputFile | str | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, has_spoiler: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
141
|
+
"""Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
|
142
|
+
|
|
143
|
+
https://core.telegram.org/bots/api#sendanimation
|
|
144
|
+
"""
|
|
145
|
+
return await self.request("sendAnimation", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "animation": animation, "duration": duration, "width": width, "height": height, "thumbnail": thumbnail, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "has_spoiler": has_spoiler, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
146
|
+
|
|
147
|
+
async def send_voice(self, chat_id: int | str, voice: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, duration: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
148
|
+
"""Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
|
|
149
|
+
|
|
150
|
+
https://core.telegram.org/bots/api#sendvoice
|
|
151
|
+
"""
|
|
152
|
+
return await self.request("sendVoice", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "voice": voice, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "duration": duration, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
153
|
+
|
|
154
|
+
async def send_video_note(self, chat_id: int | str, video_note: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, duration: int | None = None, length: int | None = None, thumbnail: InputFile | str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
155
|
+
"""Use this method to send a rounded square MPEG4 video of up to 1 minute long.
|
|
156
|
+
|
|
157
|
+
https://core.telegram.org/bots/api#sendvideonote
|
|
158
|
+
"""
|
|
159
|
+
return await self.request("sendVideoNote", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "video_note": video_note, "duration": duration, "length": length, "thumbnail": thumbnail, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
160
|
+
|
|
161
|
+
async def send_paid_media(self, chat_id: int | str, star_count: int, media: list[InputPaidMedia], *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, payload: str | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
162
|
+
"""Use this method to send paid media.
|
|
163
|
+
|
|
164
|
+
https://core.telegram.org/bots/api#sendpaidmedia
|
|
165
|
+
"""
|
|
166
|
+
return await self.request("sendPaidMedia", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "star_count": star_count, "media": media, "payload": payload, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
167
|
+
|
|
168
|
+
async def send_media_group(self, chat_id: int | str, media: list[InputMediaAudio] | list[InputMediaDocument] | list[InputMediaLivePhoto] | list[InputMediaPhoto] | list[InputMediaVideo], *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, reply_parameters: ReplyParameters | None = None) -> list[Message]:
|
|
169
|
+
"""Use this method to send a group of photos, live photos, videos, documents or audios as an album.
|
|
170
|
+
|
|
171
|
+
https://core.telegram.org/bots/api#sendmediagroup
|
|
172
|
+
"""
|
|
173
|
+
return await self.request("sendMediaGroup", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "media": media, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "reply_parameters": reply_parameters}, 'list[Message]')
|
|
174
|
+
|
|
175
|
+
async def send_location(self, chat_id: int | str, latitude: float, longitude: float, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, horizontal_accuracy: float | None = None, live_period: int | None = None, heading: int | None = None, proximity_alert_radius: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
176
|
+
"""Use this method to send point on the map.
|
|
177
|
+
|
|
178
|
+
https://core.telegram.org/bots/api#sendlocation
|
|
179
|
+
"""
|
|
180
|
+
return await self.request("sendLocation", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "latitude": latitude, "longitude": longitude, "horizontal_accuracy": horizontal_accuracy, "live_period": live_period, "heading": heading, "proximity_alert_radius": proximity_alert_radius, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
181
|
+
|
|
182
|
+
async def send_venue(self, chat_id: int | str, latitude: float, longitude: float, title: str, address: str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, foursquare_id: str | None = None, foursquare_type: str | None = None, google_place_id: str | None = None, google_place_type: str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
183
|
+
"""Use this method to send information about a venue.
|
|
184
|
+
|
|
185
|
+
https://core.telegram.org/bots/api#sendvenue
|
|
186
|
+
"""
|
|
187
|
+
return await self.request("sendVenue", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "latitude": latitude, "longitude": longitude, "title": title, "address": address, "foursquare_id": foursquare_id, "foursquare_type": foursquare_type, "google_place_id": google_place_id, "google_place_type": google_place_type, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
188
|
+
|
|
189
|
+
async def send_contact(self, chat_id: int | str, phone_number: str, first_name: str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, last_name: str | None = None, vcard: str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
190
|
+
"""Use this method to send phone contacts.
|
|
191
|
+
|
|
192
|
+
https://core.telegram.org/bots/api#sendcontact
|
|
193
|
+
"""
|
|
194
|
+
return await self.request("sendContact", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "phone_number": phone_number, "first_name": first_name, "last_name": last_name, "vcard": vcard, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
195
|
+
|
|
196
|
+
async def send_poll(self, chat_id: int | str, question: str, options: list[InputPollOption], *, business_connection_id: str | None = None, message_thread_id: int | None = None, question_parse_mode: str | None = None, question_entities: list[MessageEntity] | None = None, is_anonymous: bool | None = None, type: str | None = None, allows_multiple_answers: bool | None = None, allows_revoting: bool | None = None, shuffle_options: bool | None = None, allow_adding_options: bool | None = None, hide_results_until_closes: bool | None = None, members_only: bool | None = None, country_codes: list[str] | None = None, correct_option_ids: list[int] | None = None, explanation: str | None = None, explanation_parse_mode: str | None = None, explanation_entities: list[MessageEntity] | None = None, explanation_media: InputPollMedia | None = None, open_period: int | None = None, close_date: int | None = None, is_closed: bool | None = None, description: str | None = None, description_parse_mode: str | None = None, description_entities: list[MessageEntity] | None = None, media: InputPollMedia | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
197
|
+
"""Use this method to send a native poll.
|
|
198
|
+
|
|
199
|
+
https://core.telegram.org/bots/api#sendpoll
|
|
200
|
+
"""
|
|
201
|
+
return await self.request("sendPoll", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "question": question, "question_parse_mode": question_parse_mode, "question_entities": question_entities, "options": options, "is_anonymous": is_anonymous, "type": type, "allows_multiple_answers": allows_multiple_answers, "allows_revoting": allows_revoting, "shuffle_options": shuffle_options, "allow_adding_options": allow_adding_options, "hide_results_until_closes": hide_results_until_closes, "members_only": members_only, "country_codes": country_codes, "correct_option_ids": correct_option_ids, "explanation": explanation, "explanation_parse_mode": explanation_parse_mode, "explanation_entities": explanation_entities, "explanation_media": explanation_media, "open_period": open_period, "close_date": close_date, "is_closed": is_closed, "description": description, "description_parse_mode": description_parse_mode, "description_entities": description_entities, "media": media, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
202
|
+
|
|
203
|
+
async def send_checklist(self, business_connection_id: str, chat_id: int | str, checklist: InputChecklist, *, disable_notification: bool | None = None, protect_content: bool | None = None, message_effect_id: str | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message:
|
|
204
|
+
"""Use this method to send a checklist on behalf of a connected business account.
|
|
205
|
+
|
|
206
|
+
https://core.telegram.org/bots/api#sendchecklist
|
|
207
|
+
"""
|
|
208
|
+
return await self.request("sendChecklist", {"business_connection_id": business_connection_id, "chat_id": chat_id, "checklist": checklist, "disable_notification": disable_notification, "protect_content": protect_content, "message_effect_id": message_effect_id, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
209
|
+
|
|
210
|
+
async def send_dice(self, chat_id: int | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, emoji: str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
211
|
+
"""Use this method to send an animated emoji that will display a random value.
|
|
212
|
+
|
|
213
|
+
https://core.telegram.org/bots/api#senddice
|
|
214
|
+
"""
|
|
215
|
+
return await self.request("sendDice", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "emoji": emoji, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
216
|
+
|
|
217
|
+
async def send_message_draft(self, chat_id: int, draft_id: int, *, message_thread_id: int | None = None, text: str | None = None, parse_mode: str | None = None, entities: list[MessageEntity] | None = None, can_stop: bool | None = None, keep_on_stop: bool | None = None) -> bool:
|
|
218
|
+
"""Use this method to stream a partial message to a user while the message is being generated.
|
|
219
|
+
|
|
220
|
+
https://core.telegram.org/bots/api#sendmessagedraft
|
|
221
|
+
"""
|
|
222
|
+
return await self.request("sendMessageDraft", {"chat_id": chat_id, "message_thread_id": message_thread_id, "draft_id": draft_id, "text": text, "parse_mode": parse_mode, "entities": entities, "can_stop": can_stop, "keep_on_stop": keep_on_stop}, 'bool')
|
|
223
|
+
|
|
224
|
+
async def send_chat_action(self, chat_id: int | str, action: str, *, business_connection_id: str | None = None, message_thread_id: int | None = None) -> bool:
|
|
225
|
+
"""Use this method when you need to tell the user that something is happening on the bot's side.
|
|
226
|
+
|
|
227
|
+
https://core.telegram.org/bots/api#sendchataction
|
|
228
|
+
"""
|
|
229
|
+
return await self.request("sendChatAction", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "action": action}, 'bool')
|
|
230
|
+
|
|
231
|
+
async def set_message_reaction(self, chat_id: int | str, message_id: int, *, reaction: list[ReactionType] | None = None, is_big: bool | None = None) -> bool:
|
|
232
|
+
"""Use this method to change the chosen reactions on a message.
|
|
233
|
+
|
|
234
|
+
https://core.telegram.org/bots/api#setmessagereaction
|
|
235
|
+
"""
|
|
236
|
+
return await self.request("setMessageReaction", {"chat_id": chat_id, "message_id": message_id, "reaction": reaction, "is_big": is_big}, 'bool')
|
|
237
|
+
|
|
238
|
+
async def get_user_profile_photos(self, user_id: int, *, offset: int | None = None, limit: int | None = None) -> UserProfilePhotos:
|
|
239
|
+
"""Use this method to get a list of profile pictures for a user.
|
|
240
|
+
|
|
241
|
+
https://core.telegram.org/bots/api#getuserprofilephotos
|
|
242
|
+
"""
|
|
243
|
+
return await self.request("getUserProfilePhotos", {"user_id": user_id, "offset": offset, "limit": limit}, 'UserProfilePhotos')
|
|
244
|
+
|
|
245
|
+
async def get_user_profile_audios(self, user_id: int, *, offset: int | None = None, limit: int | None = None) -> UserProfileAudios:
|
|
246
|
+
"""Use this method to get a list of profile audios for a user.
|
|
247
|
+
|
|
248
|
+
https://core.telegram.org/bots/api#getuserprofileaudios
|
|
249
|
+
"""
|
|
250
|
+
return await self.request("getUserProfileAudios", {"user_id": user_id, "offset": offset, "limit": limit}, 'UserProfileAudios')
|
|
251
|
+
|
|
252
|
+
async def set_user_emoji_status(self, user_id: int, *, emoji_status_custom_emoji_id: str | None = None, emoji_status_expiration_date: int | None = None) -> bool:
|
|
253
|
+
"""Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess.
|
|
254
|
+
|
|
255
|
+
https://core.telegram.org/bots/api#setuseremojistatus
|
|
256
|
+
"""
|
|
257
|
+
return await self.request("setUserEmojiStatus", {"user_id": user_id, "emoji_status_custom_emoji_id": emoji_status_custom_emoji_id, "emoji_status_expiration_date": emoji_status_expiration_date}, 'bool')
|
|
258
|
+
|
|
259
|
+
async def get_file(self, file_id: str) -> File:
|
|
260
|
+
"""Use this method to get basic information about a file and prepare it for downloading.
|
|
261
|
+
|
|
262
|
+
https://core.telegram.org/bots/api#getfile
|
|
263
|
+
"""
|
|
264
|
+
return await self.request("getFile", {"file_id": file_id}, 'File')
|
|
265
|
+
|
|
266
|
+
async def ban_chat_member(self, chat_id: int | str, user_id: int, *, until_date: int | None = None, revoke_messages: bool | None = None) -> bool:
|
|
267
|
+
"""Use this method to ban a user in a group, a supergroup or a channel.
|
|
268
|
+
|
|
269
|
+
https://core.telegram.org/bots/api#banchatmember
|
|
270
|
+
"""
|
|
271
|
+
return await self.request("banChatMember", {"chat_id": chat_id, "user_id": user_id, "until_date": until_date, "revoke_messages": revoke_messages}, 'bool')
|
|
272
|
+
|
|
273
|
+
async def unban_chat_member(self, chat_id: int | str, user_id: int, *, only_if_banned: bool | None = None) -> bool:
|
|
274
|
+
"""Use this method to unban a previously banned user in a supergroup or channel.
|
|
275
|
+
|
|
276
|
+
https://core.telegram.org/bots/api#unbanchatmember
|
|
277
|
+
"""
|
|
278
|
+
return await self.request("unbanChatMember", {"chat_id": chat_id, "user_id": user_id, "only_if_banned": only_if_banned}, 'bool')
|
|
279
|
+
|
|
280
|
+
async def restrict_chat_member(self, chat_id: int | str, user_id: int, permissions: ChatPermissions, *, use_independent_chat_permissions: bool | None = None, until_date: int | None = None) -> bool:
|
|
281
|
+
"""Use this method to restrict a user in a supergroup.
|
|
282
|
+
|
|
283
|
+
https://core.telegram.org/bots/api#restrictchatmember
|
|
284
|
+
"""
|
|
285
|
+
return await self.request("restrictChatMember", {"chat_id": chat_id, "user_id": user_id, "permissions": permissions, "use_independent_chat_permissions": use_independent_chat_permissions, "until_date": until_date}, 'bool')
|
|
286
|
+
|
|
287
|
+
async def promote_chat_member(self, chat_id: int | str, user_id: int, *, is_anonymous: bool | None = None, can_manage_chat: bool | None = None, can_delete_messages: bool | None = None, can_manage_video_chats: bool | None = None, can_restrict_members: bool | None = None, can_promote_members: bool | None = None, can_change_info: bool | None = None, can_invite_users: bool | None = None, can_post_stories: bool | None = None, can_edit_stories: bool | None = None, can_delete_stories: bool | None = None, can_post_messages: bool | None = None, can_edit_messages: bool | None = None, can_pin_messages: bool | None = None, can_manage_topics: bool | None = None, can_manage_direct_messages: bool | None = None, can_manage_tags: bool | None = None, can_send_welcome_messages: bool | None = None) -> bool:
|
|
288
|
+
"""Use this method to promote or demote a user in a supergroup or a channel.
|
|
289
|
+
|
|
290
|
+
https://core.telegram.org/bots/api#promotechatmember
|
|
291
|
+
"""
|
|
292
|
+
return await self.request("promoteChatMember", {"chat_id": chat_id, "user_id": user_id, "is_anonymous": is_anonymous, "can_manage_chat": can_manage_chat, "can_delete_messages": can_delete_messages, "can_manage_video_chats": can_manage_video_chats, "can_restrict_members": can_restrict_members, "can_promote_members": can_promote_members, "can_change_info": can_change_info, "can_invite_users": can_invite_users, "can_post_stories": can_post_stories, "can_edit_stories": can_edit_stories, "can_delete_stories": can_delete_stories, "can_post_messages": can_post_messages, "can_edit_messages": can_edit_messages, "can_pin_messages": can_pin_messages, "can_manage_topics": can_manage_topics, "can_manage_direct_messages": can_manage_direct_messages, "can_manage_tags": can_manage_tags, "can_send_welcome_messages": can_send_welcome_messages}, 'bool')
|
|
293
|
+
|
|
294
|
+
async def set_chat_administrator_custom_title(self, chat_id: int | str, user_id: int, custom_title: str) -> bool:
|
|
295
|
+
"""Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
|
|
296
|
+
|
|
297
|
+
https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
298
|
+
"""
|
|
299
|
+
return await self.request("setChatAdministratorCustomTitle", {"chat_id": chat_id, "user_id": user_id, "custom_title": custom_title}, 'bool')
|
|
300
|
+
|
|
301
|
+
async def set_chat_member_tag(self, chat_id: int | str, user_id: int, *, tag: str | None = None) -> bool:
|
|
302
|
+
"""Use this method to set a tag for a regular member in a group or a supergroup.
|
|
303
|
+
|
|
304
|
+
https://core.telegram.org/bots/api#setchatmembertag
|
|
305
|
+
"""
|
|
306
|
+
return await self.request("setChatMemberTag", {"chat_id": chat_id, "user_id": user_id, "tag": tag}, 'bool')
|
|
307
|
+
|
|
308
|
+
async def ban_chat_sender_chat(self, chat_id: int | str, sender_chat_id: int) -> bool:
|
|
309
|
+
"""Use this method to ban a channel chat in a supergroup or a channel.
|
|
310
|
+
|
|
311
|
+
https://core.telegram.org/bots/api#banchatsenderchat
|
|
312
|
+
"""
|
|
313
|
+
return await self.request("banChatSenderChat", {"chat_id": chat_id, "sender_chat_id": sender_chat_id}, 'bool')
|
|
314
|
+
|
|
315
|
+
async def unban_chat_sender_chat(self, chat_id: int | str, sender_chat_id: int) -> bool:
|
|
316
|
+
"""Use this method to unban a previously banned channel chat in a supergroup or channel.
|
|
317
|
+
|
|
318
|
+
https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
319
|
+
"""
|
|
320
|
+
return await self.request("unbanChatSenderChat", {"chat_id": chat_id, "sender_chat_id": sender_chat_id}, 'bool')
|
|
321
|
+
|
|
322
|
+
async def set_chat_permissions(self, chat_id: int | str, permissions: ChatPermissions, *, use_independent_chat_permissions: bool | None = None) -> bool:
|
|
323
|
+
"""Use this method to set default chat permissions for all members.
|
|
324
|
+
|
|
325
|
+
https://core.telegram.org/bots/api#setchatpermissions
|
|
326
|
+
"""
|
|
327
|
+
return await self.request("setChatPermissions", {"chat_id": chat_id, "permissions": permissions, "use_independent_chat_permissions": use_independent_chat_permissions}, 'bool')
|
|
328
|
+
|
|
329
|
+
async def export_chat_invite_link(self, chat_id: int | str) -> str:
|
|
330
|
+
"""Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked.
|
|
331
|
+
|
|
332
|
+
https://core.telegram.org/bots/api#exportchatinvitelink
|
|
333
|
+
"""
|
|
334
|
+
return await self.request("exportChatInviteLink", {"chat_id": chat_id}, 'str')
|
|
335
|
+
|
|
336
|
+
async def create_chat_invite_link(self, chat_id: int | str, *, name: str | None = None, expire_date: int | None = None, member_limit: int | None = None, creates_join_request: bool | None = None) -> ChatInviteLink:
|
|
337
|
+
"""Use this method to create an additional invite link for a chat.
|
|
338
|
+
|
|
339
|
+
https://core.telegram.org/bots/api#createchatinvitelink
|
|
340
|
+
"""
|
|
341
|
+
return await self.request("createChatInviteLink", {"chat_id": chat_id, "name": name, "expire_date": expire_date, "member_limit": member_limit, "creates_join_request": creates_join_request}, 'ChatInviteLink')
|
|
342
|
+
|
|
343
|
+
async def edit_chat_invite_link(self, chat_id: int | str, invite_link: str, *, name: str | None = None, expire_date: int | None = None, member_limit: int | None = None, creates_join_request: bool | None = None) -> ChatInviteLink:
|
|
344
|
+
"""Use this method to edit a non-primary invite link created by the bot.
|
|
345
|
+
|
|
346
|
+
https://core.telegram.org/bots/api#editchatinvitelink
|
|
347
|
+
"""
|
|
348
|
+
return await self.request("editChatInviteLink", {"chat_id": chat_id, "invite_link": invite_link, "name": name, "expire_date": expire_date, "member_limit": member_limit, "creates_join_request": creates_join_request}, 'ChatInviteLink')
|
|
349
|
+
|
|
350
|
+
async def create_chat_subscription_invite_link(self, chat_id: int | str, subscription_period: int, subscription_price: int, *, name: str | None = None) -> ChatInviteLink:
|
|
351
|
+
"""Use this method to create a subscription invite link for a channel chat.
|
|
352
|
+
|
|
353
|
+
https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
|
354
|
+
"""
|
|
355
|
+
return await self.request("createChatSubscriptionInviteLink", {"chat_id": chat_id, "name": name, "subscription_period": subscription_period, "subscription_price": subscription_price}, 'ChatInviteLink')
|
|
356
|
+
|
|
357
|
+
async def edit_chat_subscription_invite_link(self, chat_id: int | str, invite_link: str, *, name: str | None = None) -> ChatInviteLink:
|
|
358
|
+
"""Use this method to edit a subscription invite link created by the bot.
|
|
359
|
+
|
|
360
|
+
https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
|
361
|
+
"""
|
|
362
|
+
return await self.request("editChatSubscriptionInviteLink", {"chat_id": chat_id, "invite_link": invite_link, "name": name}, 'ChatInviteLink')
|
|
363
|
+
|
|
364
|
+
async def revoke_chat_invite_link(self, chat_id: int | str, invite_link: str) -> ChatInviteLink:
|
|
365
|
+
"""Use this method to revoke an invite link created by the bot.
|
|
366
|
+
|
|
367
|
+
https://core.telegram.org/bots/api#revokechatinvitelink
|
|
368
|
+
"""
|
|
369
|
+
return await self.request("revokeChatInviteLink", {"chat_id": chat_id, "invite_link": invite_link}, 'ChatInviteLink')
|
|
370
|
+
|
|
371
|
+
async def approve_chat_join_request(self, chat_id: int | str, user_id: int) -> bool:
|
|
372
|
+
"""Use this method to approve a chat join request.
|
|
373
|
+
|
|
374
|
+
https://core.telegram.org/bots/api#approvechatjoinrequest
|
|
375
|
+
"""
|
|
376
|
+
return await self.request("approveChatJoinRequest", {"chat_id": chat_id, "user_id": user_id}, 'bool')
|
|
377
|
+
|
|
378
|
+
async def decline_chat_join_request(self, chat_id: int | str, user_id: int) -> bool:
|
|
379
|
+
"""Use this method to decline a chat join request.
|
|
380
|
+
|
|
381
|
+
https://core.telegram.org/bots/api#declinechatjoinrequest
|
|
382
|
+
"""
|
|
383
|
+
return await self.request("declineChatJoinRequest", {"chat_id": chat_id, "user_id": user_id}, 'bool')
|
|
384
|
+
|
|
385
|
+
async def answer_chat_join_request_query(self, chat_join_request_query_id: str, result: str) -> bool:
|
|
386
|
+
"""Use this method to process a received chat join request query.
|
|
387
|
+
|
|
388
|
+
https://core.telegram.org/bots/api#answerchatjoinrequestquery
|
|
389
|
+
"""
|
|
390
|
+
return await self.request("answerChatJoinRequestQuery", {"chat_join_request_query_id": chat_join_request_query_id, "result": result}, 'bool')
|
|
391
|
+
|
|
392
|
+
async def send_chat_join_request_web_app(self, chat_join_request_query_id: str, web_app_url: str) -> bool:
|
|
393
|
+
"""Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome.
|
|
394
|
+
|
|
395
|
+
https://core.telegram.org/bots/api#sendchatjoinrequestwebapp
|
|
396
|
+
"""
|
|
397
|
+
return await self.request("sendChatJoinRequestWebApp", {"chat_join_request_query_id": chat_join_request_query_id, "web_app_url": web_app_url}, 'bool')
|
|
398
|
+
|
|
399
|
+
async def set_chat_photo(self, chat_id: int | str, photo: InputFile) -> bool:
|
|
400
|
+
"""Use this method to set a new profile photo for the chat.
|
|
401
|
+
|
|
402
|
+
https://core.telegram.org/bots/api#setchatphoto
|
|
403
|
+
"""
|
|
404
|
+
return await self.request("setChatPhoto", {"chat_id": chat_id, "photo": photo}, 'bool')
|
|
405
|
+
|
|
406
|
+
async def delete_chat_photo(self, chat_id: int | str) -> bool:
|
|
407
|
+
"""Use this method to delete a chat photo.
|
|
408
|
+
|
|
409
|
+
https://core.telegram.org/bots/api#deletechatphoto
|
|
410
|
+
"""
|
|
411
|
+
return await self.request("deleteChatPhoto", {"chat_id": chat_id}, 'bool')
|
|
412
|
+
|
|
413
|
+
async def set_chat_title(self, chat_id: int | str, title: str) -> bool:
|
|
414
|
+
"""Use this method to change the title of a chat.
|
|
415
|
+
|
|
416
|
+
https://core.telegram.org/bots/api#setchattitle
|
|
417
|
+
"""
|
|
418
|
+
return await self.request("setChatTitle", {"chat_id": chat_id, "title": title}, 'bool')
|
|
419
|
+
|
|
420
|
+
async def set_chat_description(self, chat_id: int | str, *, description: str | None = None) -> bool:
|
|
421
|
+
"""Use this method to change the description of a group, a supergroup or a channel.
|
|
422
|
+
|
|
423
|
+
https://core.telegram.org/bots/api#setchatdescription
|
|
424
|
+
"""
|
|
425
|
+
return await self.request("setChatDescription", {"chat_id": chat_id, "description": description}, 'bool')
|
|
426
|
+
|
|
427
|
+
async def pin_chat_message(self, chat_id: int | str, message_id: int, *, business_connection_id: str | None = None, disable_notification: bool | None = None) -> bool:
|
|
428
|
+
"""Use this method to add a message to the list of pinned messages in a chat.
|
|
429
|
+
|
|
430
|
+
https://core.telegram.org/bots/api#pinchatmessage
|
|
431
|
+
"""
|
|
432
|
+
return await self.request("pinChatMessage", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "disable_notification": disable_notification}, 'bool')
|
|
433
|
+
|
|
434
|
+
async def unpin_chat_message(self, chat_id: int | str, *, business_connection_id: str | None = None, message_id: int | None = None) -> bool:
|
|
435
|
+
"""Use this method to remove a message from the list of pinned messages in a chat.
|
|
436
|
+
|
|
437
|
+
https://core.telegram.org/bots/api#unpinchatmessage
|
|
438
|
+
"""
|
|
439
|
+
return await self.request("unpinChatMessage", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id}, 'bool')
|
|
440
|
+
|
|
441
|
+
async def unpin_all_chat_messages(self, chat_id: int | str) -> bool:
|
|
442
|
+
"""Use this method to clear the list of pinned messages in a chat.
|
|
443
|
+
|
|
444
|
+
https://core.telegram.org/bots/api#unpinallchatmessages
|
|
445
|
+
"""
|
|
446
|
+
return await self.request("unpinAllChatMessages", {"chat_id": chat_id}, 'bool')
|
|
447
|
+
|
|
448
|
+
async def leave_chat(self, chat_id: int | str) -> bool:
|
|
449
|
+
"""Use this method for your bot to leave a group, supergroup or channel.
|
|
450
|
+
|
|
451
|
+
https://core.telegram.org/bots/api#leavechat
|
|
452
|
+
"""
|
|
453
|
+
return await self.request("leaveChat", {"chat_id": chat_id}, 'bool')
|
|
454
|
+
|
|
455
|
+
async def get_chat(self, chat_id: int | str) -> ChatFullInfo:
|
|
456
|
+
"""Use this method to get up-to-date information about the chat.
|
|
457
|
+
|
|
458
|
+
https://core.telegram.org/bots/api#getchat
|
|
459
|
+
"""
|
|
460
|
+
return await self.request("getChat", {"chat_id": chat_id}, 'ChatFullInfo')
|
|
461
|
+
|
|
462
|
+
async def get_chat_administrators(self, chat_id: int | str, *, return_bots: bool | None = None) -> list[ChatMember]:
|
|
463
|
+
"""Use this method to get a list of administrators in a chat.
|
|
464
|
+
|
|
465
|
+
https://core.telegram.org/bots/api#getchatadministrators
|
|
466
|
+
"""
|
|
467
|
+
return await self.request("getChatAdministrators", {"chat_id": chat_id, "return_bots": return_bots}, 'list[ChatMember]')
|
|
468
|
+
|
|
469
|
+
async def get_chat_member_count(self, chat_id: int | str) -> int:
|
|
470
|
+
"""Use this method to get the number of members in a chat.
|
|
471
|
+
|
|
472
|
+
https://core.telegram.org/bots/api#getchatmembercount
|
|
473
|
+
"""
|
|
474
|
+
return await self.request("getChatMemberCount", {"chat_id": chat_id}, 'int')
|
|
475
|
+
|
|
476
|
+
async def get_chat_member(self, chat_id: int | str, user_id: int) -> ChatMember:
|
|
477
|
+
"""Use this method to get information about a member of a chat.
|
|
478
|
+
|
|
479
|
+
https://core.telegram.org/bots/api#getchatmember
|
|
480
|
+
"""
|
|
481
|
+
return await self.request("getChatMember", {"chat_id": chat_id, "user_id": user_id}, 'ChatMember')
|
|
482
|
+
|
|
483
|
+
async def get_user_personal_chat_messages(self, user_id: int, limit: int) -> list[Message]:
|
|
484
|
+
"""Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user.
|
|
485
|
+
|
|
486
|
+
https://core.telegram.org/bots/api#getuserpersonalchatmessages
|
|
487
|
+
"""
|
|
488
|
+
return await self.request("getUserPersonalChatMessages", {"user_id": user_id, "limit": limit}, 'list[Message]')
|
|
489
|
+
|
|
490
|
+
async def set_chat_sticker_set(self, chat_id: int | str, sticker_set_name: str) -> bool:
|
|
491
|
+
"""Use this method to set a new group sticker set for a supergroup.
|
|
492
|
+
|
|
493
|
+
https://core.telegram.org/bots/api#setchatstickerset
|
|
494
|
+
"""
|
|
495
|
+
return await self.request("setChatStickerSet", {"chat_id": chat_id, "sticker_set_name": sticker_set_name}, 'bool')
|
|
496
|
+
|
|
497
|
+
async def delete_chat_sticker_set(self, chat_id: int | str) -> bool:
|
|
498
|
+
"""Use this method to delete a group sticker set from a supergroup.
|
|
499
|
+
|
|
500
|
+
https://core.telegram.org/bots/api#deletechatstickerset
|
|
501
|
+
"""
|
|
502
|
+
return await self.request("deleteChatStickerSet", {"chat_id": chat_id}, 'bool')
|
|
503
|
+
|
|
504
|
+
async def get_forum_topic_icon_stickers(self) -> list[Sticker]:
|
|
505
|
+
"""Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
|
|
506
|
+
|
|
507
|
+
https://core.telegram.org/bots/api#getforumtopiciconstickers
|
|
508
|
+
"""
|
|
509
|
+
return await self.request("getForumTopicIconStickers", {}, 'list[Sticker]')
|
|
510
|
+
|
|
511
|
+
async def create_forum_topic(self, chat_id: int | str, name: str, *, icon_color: int | None = None, icon_custom_emoji_id: str | None = None) -> ForumTopic:
|
|
512
|
+
"""Use this method to create a topic in a forum supergroup chat or a private chat with a user.
|
|
513
|
+
|
|
514
|
+
https://core.telegram.org/bots/api#createforumtopic
|
|
515
|
+
"""
|
|
516
|
+
return await self.request("createForumTopic", {"chat_id": chat_id, "name": name, "icon_color": icon_color, "icon_custom_emoji_id": icon_custom_emoji_id}, 'ForumTopic')
|
|
517
|
+
|
|
518
|
+
async def edit_forum_topic(self, chat_id: int | str, message_thread_id: int, *, name: str | None = None, icon_custom_emoji_id: str | None = None) -> bool:
|
|
519
|
+
"""Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user.
|
|
520
|
+
|
|
521
|
+
https://core.telegram.org/bots/api#editforumtopic
|
|
522
|
+
"""
|
|
523
|
+
return await self.request("editForumTopic", {"chat_id": chat_id, "message_thread_id": message_thread_id, "name": name, "icon_custom_emoji_id": icon_custom_emoji_id}, 'bool')
|
|
524
|
+
|
|
525
|
+
async def close_forum_topic(self, chat_id: int | str, message_thread_id: int) -> bool:
|
|
526
|
+
"""Use this method to close an open topic in a forum supergroup chat.
|
|
527
|
+
|
|
528
|
+
https://core.telegram.org/bots/api#closeforumtopic
|
|
529
|
+
"""
|
|
530
|
+
return await self.request("closeForumTopic", {"chat_id": chat_id, "message_thread_id": message_thread_id}, 'bool')
|
|
531
|
+
|
|
532
|
+
async def reopen_forum_topic(self, chat_id: int | str, message_thread_id: int) -> bool:
|
|
533
|
+
"""Use this method to reopen a closed topic in a forum supergroup chat.
|
|
534
|
+
|
|
535
|
+
https://core.telegram.org/bots/api#reopenforumtopic
|
|
536
|
+
"""
|
|
537
|
+
return await self.request("reopenForumTopic", {"chat_id": chat_id, "message_thread_id": message_thread_id}, 'bool')
|
|
538
|
+
|
|
539
|
+
async def delete_forum_topic(self, chat_id: int | str, message_thread_id: int) -> bool:
|
|
540
|
+
"""Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user.
|
|
541
|
+
|
|
542
|
+
https://core.telegram.org/bots/api#deleteforumtopic
|
|
543
|
+
"""
|
|
544
|
+
return await self.request("deleteForumTopic", {"chat_id": chat_id, "message_thread_id": message_thread_id}, 'bool')
|
|
545
|
+
|
|
546
|
+
async def unpin_all_forum_topic_messages(self, chat_id: int | str, message_thread_id: int) -> bool:
|
|
547
|
+
"""Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user.
|
|
548
|
+
|
|
549
|
+
https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
|
550
|
+
"""
|
|
551
|
+
return await self.request("unpinAllForumTopicMessages", {"chat_id": chat_id, "message_thread_id": message_thread_id}, 'bool')
|
|
552
|
+
|
|
553
|
+
async def edit_general_forum_topic(self, chat_id: int | str, name: str) -> bool:
|
|
554
|
+
"""Use this method to edit the name of the 'General' topic in a forum supergroup chat.
|
|
555
|
+
|
|
556
|
+
https://core.telegram.org/bots/api#editgeneralforumtopic
|
|
557
|
+
"""
|
|
558
|
+
return await self.request("editGeneralForumTopic", {"chat_id": chat_id, "name": name}, 'bool')
|
|
559
|
+
|
|
560
|
+
async def close_general_forum_topic(self, chat_id: int | str) -> bool:
|
|
561
|
+
"""Use this method to close an open 'General' topic in a forum supergroup chat.
|
|
562
|
+
|
|
563
|
+
https://core.telegram.org/bots/api#closegeneralforumtopic
|
|
564
|
+
"""
|
|
565
|
+
return await self.request("closeGeneralForumTopic", {"chat_id": chat_id}, 'bool')
|
|
566
|
+
|
|
567
|
+
async def reopen_general_forum_topic(self, chat_id: int | str) -> bool:
|
|
568
|
+
"""Use this method to reopen a closed 'General' topic in a forum supergroup chat.
|
|
569
|
+
|
|
570
|
+
https://core.telegram.org/bots/api#reopengeneralforumtopic
|
|
571
|
+
"""
|
|
572
|
+
return await self.request("reopenGeneralForumTopic", {"chat_id": chat_id}, 'bool')
|
|
573
|
+
|
|
574
|
+
async def hide_general_forum_topic(self, chat_id: int | str) -> bool:
|
|
575
|
+
"""Use this method to hide the 'General' topic in a forum supergroup chat.
|
|
576
|
+
|
|
577
|
+
https://core.telegram.org/bots/api#hidegeneralforumtopic
|
|
578
|
+
"""
|
|
579
|
+
return await self.request("hideGeneralForumTopic", {"chat_id": chat_id}, 'bool')
|
|
580
|
+
|
|
581
|
+
async def unhide_general_forum_topic(self, chat_id: int | str) -> bool:
|
|
582
|
+
"""Use this method to unhide the 'General' topic in a forum supergroup chat.
|
|
583
|
+
|
|
584
|
+
https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
|
585
|
+
"""
|
|
586
|
+
return await self.request("unhideGeneralForumTopic", {"chat_id": chat_id}, 'bool')
|
|
587
|
+
|
|
588
|
+
async def unpin_all_general_forum_topic_messages(self, chat_id: int | str) -> bool:
|
|
589
|
+
"""Use this method to clear the list of pinned messages in a General forum topic.
|
|
590
|
+
|
|
591
|
+
https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
|
592
|
+
"""
|
|
593
|
+
return await self.request("unpinAllGeneralForumTopicMessages", {"chat_id": chat_id}, 'bool')
|
|
594
|
+
|
|
595
|
+
async def answer_callback_query(self, callback_query_id: str, *, text: str | None = None, show_alert: bool | None = None, url: str | None = None, cache_time: int | None = None) -> bool:
|
|
596
|
+
"""Use this method to send answers to callback queries sent from inline keyboards.
|
|
597
|
+
|
|
598
|
+
https://core.telegram.org/bots/api#answercallbackquery
|
|
599
|
+
"""
|
|
600
|
+
return await self.request("answerCallbackQuery", {"callback_query_id": callback_query_id, "text": text, "show_alert": show_alert, "url": url, "cache_time": cache_time}, 'bool')
|
|
601
|
+
|
|
602
|
+
async def answer_guest_query(self, guest_query_id: str, result: InlineQueryResult) -> SentGuestMessage:
|
|
603
|
+
"""Use this method to reply to a received guest message.
|
|
604
|
+
|
|
605
|
+
https://core.telegram.org/bots/api#answerguestquery
|
|
606
|
+
"""
|
|
607
|
+
return await self.request("answerGuestQuery", {"guest_query_id": guest_query_id, "result": result}, 'SentGuestMessage')
|
|
608
|
+
|
|
609
|
+
async def get_user_chat_boosts(self, chat_id: int | str, user_id: int) -> UserChatBoosts:
|
|
610
|
+
"""Use this method to get the list of boosts added to a chat by a user.
|
|
611
|
+
|
|
612
|
+
https://core.telegram.org/bots/api#getuserchatboosts
|
|
613
|
+
"""
|
|
614
|
+
return await self.request("getUserChatBoosts", {"chat_id": chat_id, "user_id": user_id}, 'UserChatBoosts')
|
|
615
|
+
|
|
616
|
+
async def get_business_connection(self, business_connection_id: str) -> BusinessConnection:
|
|
617
|
+
"""Use this method to get information about the connection of the bot with a business account.
|
|
618
|
+
|
|
619
|
+
https://core.telegram.org/bots/api#getbusinessconnection
|
|
620
|
+
"""
|
|
621
|
+
return await self.request("getBusinessConnection", {"business_connection_id": business_connection_id}, 'BusinessConnection')
|
|
622
|
+
|
|
623
|
+
async def get_managed_bot_token(self, user_id: int) -> str:
|
|
624
|
+
"""Use this method to get the token of a managed bot.
|
|
625
|
+
|
|
626
|
+
https://core.telegram.org/bots/api#getmanagedbottoken
|
|
627
|
+
"""
|
|
628
|
+
return await self.request("getManagedBotToken", {"user_id": user_id}, 'str')
|
|
629
|
+
|
|
630
|
+
async def replace_managed_bot_token(self, user_id: int) -> str:
|
|
631
|
+
"""Use this method to revoke the current token of a managed bot and generate a new one.
|
|
632
|
+
|
|
633
|
+
https://core.telegram.org/bots/api#replacemanagedbottoken
|
|
634
|
+
"""
|
|
635
|
+
return await self.request("replaceManagedBotToken", {"user_id": user_id}, 'str')
|
|
636
|
+
|
|
637
|
+
async def get_managed_bot_access_settings(self, user_id: int) -> BotAccessSettings:
|
|
638
|
+
"""Use this method to get the access settings of a managed bot.
|
|
639
|
+
|
|
640
|
+
https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
|
641
|
+
"""
|
|
642
|
+
return await self.request("getManagedBotAccessSettings", {"user_id": user_id}, 'BotAccessSettings')
|
|
643
|
+
|
|
644
|
+
async def set_managed_bot_access_settings(self, user_id: int, is_access_restricted: bool, *, added_user_ids: list[int] | None = None) -> bool:
|
|
645
|
+
"""Use this method to change the access settings of a managed bot.
|
|
646
|
+
|
|
647
|
+
https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
|
648
|
+
"""
|
|
649
|
+
return await self.request("setManagedBotAccessSettings", {"user_id": user_id, "is_access_restricted": is_access_restricted, "added_user_ids": added_user_ids}, 'bool')
|
|
650
|
+
|
|
651
|
+
async def set_my_commands(self, commands: list[BotCommand], *, scope: BotCommandScope | None = None, language_code: str | None = None) -> bool:
|
|
652
|
+
"""Use this method to change the list of the bot's commands.
|
|
653
|
+
|
|
654
|
+
https://core.telegram.org/bots/api#setmycommands
|
|
655
|
+
"""
|
|
656
|
+
return await self.request("setMyCommands", {"commands": commands, "scope": scope, "language_code": language_code}, 'bool')
|
|
657
|
+
|
|
658
|
+
async def delete_my_commands(self, *, scope: BotCommandScope | None = None, language_code: str | None = None) -> bool:
|
|
659
|
+
"""Use this method to delete the list of the bot's commands for the given scope and user language.
|
|
660
|
+
|
|
661
|
+
https://core.telegram.org/bots/api#deletemycommands
|
|
662
|
+
"""
|
|
663
|
+
return await self.request("deleteMyCommands", {"scope": scope, "language_code": language_code}, 'bool')
|
|
664
|
+
|
|
665
|
+
async def get_my_commands(self, *, scope: BotCommandScope | None = None, language_code: str | None = None) -> list[BotCommand]:
|
|
666
|
+
"""Use this method to get the current list of the bot's commands for the given scope and user language.
|
|
667
|
+
|
|
668
|
+
https://core.telegram.org/bots/api#getmycommands
|
|
669
|
+
"""
|
|
670
|
+
return await self.request("getMyCommands", {"scope": scope, "language_code": language_code}, 'list[BotCommand]')
|
|
671
|
+
|
|
672
|
+
async def set_my_name(self, *, name: str | None = None, language_code: str | None = None) -> bool:
|
|
673
|
+
"""Use this method to change the bot's name.
|
|
674
|
+
|
|
675
|
+
https://core.telegram.org/bots/api#setmyname
|
|
676
|
+
"""
|
|
677
|
+
return await self.request("setMyName", {"name": name, "language_code": language_code}, 'bool')
|
|
678
|
+
|
|
679
|
+
async def get_my_name(self, *, language_code: str | None = None) -> BotName:
|
|
680
|
+
"""Use this method to get the current bot name for the given user language.
|
|
681
|
+
|
|
682
|
+
https://core.telegram.org/bots/api#getmyname
|
|
683
|
+
"""
|
|
684
|
+
return await self.request("getMyName", {"language_code": language_code}, 'BotName')
|
|
685
|
+
|
|
686
|
+
async def set_my_description(self, *, description: str | None = None, language_code: str | None = None) -> bool:
|
|
687
|
+
"""Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
|
|
688
|
+
|
|
689
|
+
https://core.telegram.org/bots/api#setmydescription
|
|
690
|
+
"""
|
|
691
|
+
return await self.request("setMyDescription", {"description": description, "language_code": language_code}, 'bool')
|
|
692
|
+
|
|
693
|
+
async def get_my_description(self, *, language_code: str | None = None) -> BotDescription:
|
|
694
|
+
"""Use this method to get the current bot description for the given user language.
|
|
695
|
+
|
|
696
|
+
https://core.telegram.org/bots/api#getmydescription
|
|
697
|
+
"""
|
|
698
|
+
return await self.request("getMyDescription", {"language_code": language_code}, 'BotDescription')
|
|
699
|
+
|
|
700
|
+
async def set_my_short_description(self, *, short_description: str | None = None, language_code: str | None = None) -> bool:
|
|
701
|
+
"""Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
|
|
702
|
+
|
|
703
|
+
https://core.telegram.org/bots/api#setmyshortdescription
|
|
704
|
+
"""
|
|
705
|
+
return await self.request("setMyShortDescription", {"short_description": short_description, "language_code": language_code}, 'bool')
|
|
706
|
+
|
|
707
|
+
async def get_my_short_description(self, *, language_code: str | None = None) -> BotShortDescription:
|
|
708
|
+
"""Use this method to get the current bot short description for the given user language.
|
|
709
|
+
|
|
710
|
+
https://core.telegram.org/bots/api#getmyshortdescription
|
|
711
|
+
"""
|
|
712
|
+
return await self.request("getMyShortDescription", {"language_code": language_code}, 'BotShortDescription')
|
|
713
|
+
|
|
714
|
+
async def set_my_profile_photo(self, photo: InputProfilePhoto) -> bool:
|
|
715
|
+
"""Changes the profile photo of the bot.
|
|
716
|
+
|
|
717
|
+
https://core.telegram.org/bots/api#setmyprofilephoto
|
|
718
|
+
"""
|
|
719
|
+
return await self.request("setMyProfilePhoto", {"photo": photo}, 'bool')
|
|
720
|
+
|
|
721
|
+
async def remove_my_profile_photo(self) -> bool:
|
|
722
|
+
"""Removes the profile photo of the bot.
|
|
723
|
+
|
|
724
|
+
https://core.telegram.org/bots/api#removemyprofilephoto
|
|
725
|
+
"""
|
|
726
|
+
return await self.request("removeMyProfilePhoto", {}, 'bool')
|
|
727
|
+
|
|
728
|
+
async def set_chat_menu_button(self, *, chat_id: int | None = None, menu_button: MenuButton | None = None) -> bool:
|
|
729
|
+
"""Use this method to change the bot's menu button in a private chat, or the default menu button.
|
|
730
|
+
|
|
731
|
+
https://core.telegram.org/bots/api#setchatmenubutton
|
|
732
|
+
"""
|
|
733
|
+
return await self.request("setChatMenuButton", {"chat_id": chat_id, "menu_button": menu_button}, 'bool')
|
|
734
|
+
|
|
735
|
+
async def get_chat_menu_button(self, *, chat_id: int | None = None) -> MenuButton:
|
|
736
|
+
"""Use this method to get the current value of the bot's menu button in a private chat, or the default menu button.
|
|
737
|
+
|
|
738
|
+
https://core.telegram.org/bots/api#getchatmenubutton
|
|
739
|
+
"""
|
|
740
|
+
return await self.request("getChatMenuButton", {"chat_id": chat_id}, 'MenuButton')
|
|
741
|
+
|
|
742
|
+
async def set_my_default_administrator_rights(self, *, rights: ChatAdministratorRights | None = None, for_channels: bool | None = None) -> bool:
|
|
743
|
+
"""Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels.
|
|
744
|
+
|
|
745
|
+
https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
|
746
|
+
"""
|
|
747
|
+
return await self.request("setMyDefaultAdministratorRights", {"rights": rights, "for_channels": for_channels}, 'bool')
|
|
748
|
+
|
|
749
|
+
async def get_my_default_administrator_rights(self, *, for_channels: bool | None = None) -> ChatAdministratorRights:
|
|
750
|
+
"""Use this method to get the current default administrator rights of the bot.
|
|
751
|
+
|
|
752
|
+
https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
|
753
|
+
"""
|
|
754
|
+
return await self.request("getMyDefaultAdministratorRights", {"for_channels": for_channels}, 'ChatAdministratorRights')
|
|
755
|
+
|
|
756
|
+
async def get_available_gifts(self) -> Gifts:
|
|
757
|
+
"""Returns the list of gifts that can be sent by the bot to users and channel chats.
|
|
758
|
+
|
|
759
|
+
https://core.telegram.org/bots/api#getavailablegifts
|
|
760
|
+
"""
|
|
761
|
+
return await self.request("getAvailableGifts", {}, 'Gifts')
|
|
762
|
+
|
|
763
|
+
async def send_gift(self, gift_id: str, *, user_id: int | None = None, chat_id: int | str | None = None, pay_for_upgrade: bool | None = None, text: str | None = None, text_parse_mode: str | None = None, text_entities: list[MessageEntity] | None = None) -> bool:
|
|
764
|
+
"""Sends a gift to the given user or channel chat.
|
|
765
|
+
|
|
766
|
+
https://core.telegram.org/bots/api#sendgift
|
|
767
|
+
"""
|
|
768
|
+
return await self.request("sendGift", {"user_id": user_id, "chat_id": chat_id, "gift_id": gift_id, "pay_for_upgrade": pay_for_upgrade, "text": text, "text_parse_mode": text_parse_mode, "text_entities": text_entities}, 'bool')
|
|
769
|
+
|
|
770
|
+
async def gift_premium_subscription(self, user_id: int, month_count: int, star_count: int, *, text: str | None = None, text_parse_mode: str | None = None, text_entities: list[MessageEntity] | None = None) -> bool:
|
|
771
|
+
"""Gifts a Telegram Premium subscription to the given user.
|
|
772
|
+
|
|
773
|
+
https://core.telegram.org/bots/api#giftpremiumsubscription
|
|
774
|
+
"""
|
|
775
|
+
return await self.request("giftPremiumSubscription", {"user_id": user_id, "month_count": month_count, "star_count": star_count, "text": text, "text_parse_mode": text_parse_mode, "text_entities": text_entities}, 'bool')
|
|
776
|
+
|
|
777
|
+
async def verify_user(self, user_id: int, *, custom_description: str | None = None) -> bool:
|
|
778
|
+
"""Verifies a user on behalf of the organization which is represented by the bot.
|
|
779
|
+
|
|
780
|
+
https://core.telegram.org/bots/api#verifyuser
|
|
781
|
+
"""
|
|
782
|
+
return await self.request("verifyUser", {"user_id": user_id, "custom_description": custom_description}, 'bool')
|
|
783
|
+
|
|
784
|
+
async def verify_chat(self, chat_id: int | str, *, custom_description: str | None = None) -> bool:
|
|
785
|
+
"""Verifies a chat on behalf of the organization which is represented by the bot.
|
|
786
|
+
|
|
787
|
+
https://core.telegram.org/bots/api#verifychat
|
|
788
|
+
"""
|
|
789
|
+
return await self.request("verifyChat", {"chat_id": chat_id, "custom_description": custom_description}, 'bool')
|
|
790
|
+
|
|
791
|
+
async def remove_user_verification(self, user_id: int) -> bool:
|
|
792
|
+
"""Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
|
|
793
|
+
|
|
794
|
+
https://core.telegram.org/bots/api#removeuserverification
|
|
795
|
+
"""
|
|
796
|
+
return await self.request("removeUserVerification", {"user_id": user_id}, 'bool')
|
|
797
|
+
|
|
798
|
+
async def remove_chat_verification(self, chat_id: int | str) -> bool:
|
|
799
|
+
"""Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
|
|
800
|
+
|
|
801
|
+
https://core.telegram.org/bots/api#removechatverification
|
|
802
|
+
"""
|
|
803
|
+
return await self.request("removeChatVerification", {"chat_id": chat_id}, 'bool')
|
|
804
|
+
|
|
805
|
+
async def read_business_message(self, business_connection_id: str, chat_id: int, message_id: int) -> bool:
|
|
806
|
+
"""Marks incoming message as read on behalf of a business account.
|
|
807
|
+
|
|
808
|
+
https://core.telegram.org/bots/api#readbusinessmessage
|
|
809
|
+
"""
|
|
810
|
+
return await self.request("readBusinessMessage", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id}, 'bool')
|
|
811
|
+
|
|
812
|
+
async def delete_business_messages(self, business_connection_id: str, message_ids: list[int]) -> bool:
|
|
813
|
+
"""Delete messages on behalf of a business account.
|
|
814
|
+
|
|
815
|
+
https://core.telegram.org/bots/api#deletebusinessmessages
|
|
816
|
+
"""
|
|
817
|
+
return await self.request("deleteBusinessMessages", {"business_connection_id": business_connection_id, "message_ids": message_ids}, 'bool')
|
|
818
|
+
|
|
819
|
+
async def set_business_account_name(self, business_connection_id: str, first_name: str, *, last_name: str | None = None) -> bool:
|
|
820
|
+
"""Changes the first and last name of a managed business account.
|
|
821
|
+
|
|
822
|
+
https://core.telegram.org/bots/api#setbusinessaccountname
|
|
823
|
+
"""
|
|
824
|
+
return await self.request("setBusinessAccountName", {"business_connection_id": business_connection_id, "first_name": first_name, "last_name": last_name}, 'bool')
|
|
825
|
+
|
|
826
|
+
async def set_business_account_username(self, business_connection_id: str, *, username: str | None = None) -> bool:
|
|
827
|
+
"""Changes the username of a managed business account.
|
|
828
|
+
|
|
829
|
+
https://core.telegram.org/bots/api#setbusinessaccountusername
|
|
830
|
+
"""
|
|
831
|
+
return await self.request("setBusinessAccountUsername", {"business_connection_id": business_connection_id, "username": username}, 'bool')
|
|
832
|
+
|
|
833
|
+
async def set_business_account_bio(self, business_connection_id: str, *, bio: str | None = None) -> bool:
|
|
834
|
+
"""Changes the bio of a managed business account.
|
|
835
|
+
|
|
836
|
+
https://core.telegram.org/bots/api#setbusinessaccountbio
|
|
837
|
+
"""
|
|
838
|
+
return await self.request("setBusinessAccountBio", {"business_connection_id": business_connection_id, "bio": bio}, 'bool')
|
|
839
|
+
|
|
840
|
+
async def set_business_account_profile_photo(self, business_connection_id: str, photo: InputProfilePhoto, *, is_public: bool | None = None) -> bool:
|
|
841
|
+
"""Changes the profile photo of a managed business account.
|
|
842
|
+
|
|
843
|
+
https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
|
|
844
|
+
"""
|
|
845
|
+
return await self.request("setBusinessAccountProfilePhoto", {"business_connection_id": business_connection_id, "photo": photo, "is_public": is_public}, 'bool')
|
|
846
|
+
|
|
847
|
+
async def remove_business_account_profile_photo(self, business_connection_id: str, *, is_public: bool | None = None) -> bool:
|
|
848
|
+
"""Removes the current profile photo of a managed business account.
|
|
849
|
+
|
|
850
|
+
https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
|
|
851
|
+
"""
|
|
852
|
+
return await self.request("removeBusinessAccountProfilePhoto", {"business_connection_id": business_connection_id, "is_public": is_public}, 'bool')
|
|
853
|
+
|
|
854
|
+
async def set_business_account_gift_settings(self, business_connection_id: str, show_gift_button: bool, accepted_gift_types: AcceptedGiftTypes) -> bool:
|
|
855
|
+
"""Changes the privacy settings pertaining to incoming gifts in a managed business account.
|
|
856
|
+
|
|
857
|
+
https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
|
|
858
|
+
"""
|
|
859
|
+
return await self.request("setBusinessAccountGiftSettings", {"business_connection_id": business_connection_id, "show_gift_button": show_gift_button, "accepted_gift_types": accepted_gift_types}, 'bool')
|
|
860
|
+
|
|
861
|
+
async def get_business_account_star_balance(self, business_connection_id: str) -> StarAmount:
|
|
862
|
+
"""Returns the amount of Telegram Stars owned by a managed business account.
|
|
863
|
+
|
|
864
|
+
https://core.telegram.org/bots/api#getbusinessaccountstarbalance
|
|
865
|
+
"""
|
|
866
|
+
return await self.request("getBusinessAccountStarBalance", {"business_connection_id": business_connection_id}, 'StarAmount')
|
|
867
|
+
|
|
868
|
+
async def transfer_business_account_stars(self, business_connection_id: str, star_count: int) -> bool:
|
|
869
|
+
"""Transfers Telegram Stars from the business account balance to the bot's balance.
|
|
870
|
+
|
|
871
|
+
https://core.telegram.org/bots/api#transferbusinessaccountstars
|
|
872
|
+
"""
|
|
873
|
+
return await self.request("transferBusinessAccountStars", {"business_connection_id": business_connection_id, "star_count": star_count}, 'bool')
|
|
874
|
+
|
|
875
|
+
async def get_business_account_gifts(self, business_connection_id: str, *, exclude_unsaved: bool | None = None, exclude_saved: bool | None = None, exclude_unlimited: bool | None = None, exclude_limited_upgradable: bool | None = None, exclude_limited_non_upgradable: bool | None = None, exclude_unique: bool | None = None, exclude_from_blockchain: bool | None = None, sort_by_price: bool | None = None, offset: str | None = None, limit: int | None = None) -> OwnedGifts:
|
|
876
|
+
"""Returns the gifts received and owned by a managed business account.
|
|
877
|
+
|
|
878
|
+
https://core.telegram.org/bots/api#getbusinessaccountgifts
|
|
879
|
+
"""
|
|
880
|
+
return await self.request("getBusinessAccountGifts", {"business_connection_id": business_connection_id, "exclude_unsaved": exclude_unsaved, "exclude_saved": exclude_saved, "exclude_unlimited": exclude_unlimited, "exclude_limited_upgradable": exclude_limited_upgradable, "exclude_limited_non_upgradable": exclude_limited_non_upgradable, "exclude_unique": exclude_unique, "exclude_from_blockchain": exclude_from_blockchain, "sort_by_price": sort_by_price, "offset": offset, "limit": limit}, 'OwnedGifts')
|
|
881
|
+
|
|
882
|
+
async def get_user_gifts(self, user_id: int, *, exclude_unlimited: bool | None = None, exclude_limited_upgradable: bool | None = None, exclude_limited_non_upgradable: bool | None = None, exclude_from_blockchain: bool | None = None, exclude_unique: bool | None = None, sort_by_price: bool | None = None, offset: str | None = None, limit: int | None = None) -> OwnedGifts:
|
|
883
|
+
"""Returns the gifts owned and hosted by a user.
|
|
884
|
+
|
|
885
|
+
https://core.telegram.org/bots/api#getusergifts
|
|
886
|
+
"""
|
|
887
|
+
return await self.request("getUserGifts", {"user_id": user_id, "exclude_unlimited": exclude_unlimited, "exclude_limited_upgradable": exclude_limited_upgradable, "exclude_limited_non_upgradable": exclude_limited_non_upgradable, "exclude_from_blockchain": exclude_from_blockchain, "exclude_unique": exclude_unique, "sort_by_price": sort_by_price, "offset": offset, "limit": limit}, 'OwnedGifts')
|
|
888
|
+
|
|
889
|
+
async def get_chat_gifts(self, chat_id: int | str, *, exclude_unsaved: bool | None = None, exclude_saved: bool | None = None, exclude_unlimited: bool | None = None, exclude_limited_upgradable: bool | None = None, exclude_limited_non_upgradable: bool | None = None, exclude_from_blockchain: bool | None = None, exclude_unique: bool | None = None, sort_by_price: bool | None = None, offset: str | None = None, limit: int | None = None) -> OwnedGifts:
|
|
890
|
+
"""Returns the gifts owned by a chat.
|
|
891
|
+
|
|
892
|
+
https://core.telegram.org/bots/api#getchatgifts
|
|
893
|
+
"""
|
|
894
|
+
return await self.request("getChatGifts", {"chat_id": chat_id, "exclude_unsaved": exclude_unsaved, "exclude_saved": exclude_saved, "exclude_unlimited": exclude_unlimited, "exclude_limited_upgradable": exclude_limited_upgradable, "exclude_limited_non_upgradable": exclude_limited_non_upgradable, "exclude_from_blockchain": exclude_from_blockchain, "exclude_unique": exclude_unique, "sort_by_price": sort_by_price, "offset": offset, "limit": limit}, 'OwnedGifts')
|
|
895
|
+
|
|
896
|
+
async def convert_gift_to_stars(self, business_connection_id: str, owned_gift_id: str) -> bool:
|
|
897
|
+
"""Converts a given regular gift to Telegram Stars.
|
|
898
|
+
|
|
899
|
+
https://core.telegram.org/bots/api#convertgifttostars
|
|
900
|
+
"""
|
|
901
|
+
return await self.request("convertGiftToStars", {"business_connection_id": business_connection_id, "owned_gift_id": owned_gift_id}, 'bool')
|
|
902
|
+
|
|
903
|
+
async def upgrade_gift(self, business_connection_id: str, owned_gift_id: str, *, keep_original_details: bool | None = None, star_count: int | None = None) -> bool:
|
|
904
|
+
"""Upgrades a given regular gift to a unique gift.
|
|
905
|
+
|
|
906
|
+
https://core.telegram.org/bots/api#upgradegift
|
|
907
|
+
"""
|
|
908
|
+
return await self.request("upgradeGift", {"business_connection_id": business_connection_id, "owned_gift_id": owned_gift_id, "keep_original_details": keep_original_details, "star_count": star_count}, 'bool')
|
|
909
|
+
|
|
910
|
+
async def transfer_gift(self, business_connection_id: str, owned_gift_id: str, new_owner_chat_id: int, *, star_count: int | None = None) -> bool:
|
|
911
|
+
"""Transfers an owned unique gift to another user.
|
|
912
|
+
|
|
913
|
+
https://core.telegram.org/bots/api#transfergift
|
|
914
|
+
"""
|
|
915
|
+
return await self.request("transferGift", {"business_connection_id": business_connection_id, "owned_gift_id": owned_gift_id, "new_owner_chat_id": new_owner_chat_id, "star_count": star_count}, 'bool')
|
|
916
|
+
|
|
917
|
+
async def post_story(self, business_connection_id: str, content: InputStoryContent, active_period: int, *, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, areas: list[StoryArea] | None = None, post_to_chat_page: bool | None = None, protect_content: bool | None = None) -> Story:
|
|
918
|
+
"""Posts a story on behalf of a managed business account.
|
|
919
|
+
|
|
920
|
+
https://core.telegram.org/bots/api#poststory
|
|
921
|
+
"""
|
|
922
|
+
return await self.request("postStory", {"business_connection_id": business_connection_id, "content": content, "active_period": active_period, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "areas": areas, "post_to_chat_page": post_to_chat_page, "protect_content": protect_content}, 'Story')
|
|
923
|
+
|
|
924
|
+
async def repost_story(self, business_connection_id: str, from_chat_id: int, from_story_id: int, active_period: int, *, post_to_chat_page: bool | None = None, protect_content: bool | None = None) -> Story:
|
|
925
|
+
"""Reposts a story on behalf of a business account from another business account.
|
|
926
|
+
|
|
927
|
+
https://core.telegram.org/bots/api#repoststory
|
|
928
|
+
"""
|
|
929
|
+
return await self.request("repostStory", {"business_connection_id": business_connection_id, "from_chat_id": from_chat_id, "from_story_id": from_story_id, "active_period": active_period, "post_to_chat_page": post_to_chat_page, "protect_content": protect_content}, 'Story')
|
|
930
|
+
|
|
931
|
+
async def edit_story(self, business_connection_id: str, story_id: int, content: InputStoryContent, *, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, areas: list[StoryArea] | None = None) -> Story:
|
|
932
|
+
"""Edits a story previously posted by the bot on behalf of a managed business account.
|
|
933
|
+
|
|
934
|
+
https://core.telegram.org/bots/api#editstory
|
|
935
|
+
"""
|
|
936
|
+
return await self.request("editStory", {"business_connection_id": business_connection_id, "story_id": story_id, "content": content, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "areas": areas}, 'Story')
|
|
937
|
+
|
|
938
|
+
async def delete_story(self, business_connection_id: str, story_id: int) -> bool:
|
|
939
|
+
"""Deletes a story previously posted by the bot on behalf of a managed business account.
|
|
940
|
+
|
|
941
|
+
https://core.telegram.org/bots/api#deletestory
|
|
942
|
+
"""
|
|
943
|
+
return await self.request("deleteStory", {"business_connection_id": business_connection_id, "story_id": story_id}, 'bool')
|
|
944
|
+
|
|
945
|
+
async def answer_web_app_query(self, web_app_query_id: str, result: InlineQueryResult) -> SentWebAppMessage:
|
|
946
|
+
"""Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.
|
|
947
|
+
|
|
948
|
+
https://core.telegram.org/bots/api#answerwebappquery
|
|
949
|
+
"""
|
|
950
|
+
return await self.request("answerWebAppQuery", {"web_app_query_id": web_app_query_id, "result": result}, 'SentWebAppMessage')
|
|
951
|
+
|
|
952
|
+
async def save_prepared_inline_message(self, user_id: int, result: InlineQueryResult, *, allow_user_chats: bool | None = None, allow_bot_chats: bool | None = None, allow_group_chats: bool | None = None, allow_channel_chats: bool | None = None) -> PreparedInlineMessage:
|
|
953
|
+
"""Stores a message that can be sent by a user of a Mini App.
|
|
954
|
+
|
|
955
|
+
https://core.telegram.org/bots/api#savepreparedinlinemessage
|
|
956
|
+
"""
|
|
957
|
+
return await self.request("savePreparedInlineMessage", {"user_id": user_id, "result": result, "allow_user_chats": allow_user_chats, "allow_bot_chats": allow_bot_chats, "allow_group_chats": allow_group_chats, "allow_channel_chats": allow_channel_chats}, 'PreparedInlineMessage')
|
|
958
|
+
|
|
959
|
+
async def save_prepared_keyboard_button(self, user_id: int, button: KeyboardButton) -> PreparedKeyboardButton:
|
|
960
|
+
"""Stores a keyboard button that can be used by a user within a Mini App.
|
|
961
|
+
|
|
962
|
+
https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
|
963
|
+
"""
|
|
964
|
+
return await self.request("savePreparedKeyboardButton", {"user_id": user_id, "button": button}, 'PreparedKeyboardButton')
|
|
965
|
+
|
|
966
|
+
async def edit_message_text(self, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, text: str | None = None, parse_mode: str | None = None, entities: list[MessageEntity] | None = None, link_preview_options: LinkPreviewOptions | None = None, rich_message: InputRichMessage | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
967
|
+
"""Use this method to edit text, rich and game messages.
|
|
968
|
+
|
|
969
|
+
https://core.telegram.org/bots/api#editmessagetext
|
|
970
|
+
"""
|
|
971
|
+
return await self.request("editMessageText", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "text": text, "parse_mode": parse_mode, "entities": entities, "link_preview_options": link_preview_options, "rich_message": rich_message, "reply_markup": reply_markup}, 'Message | bool')
|
|
972
|
+
|
|
973
|
+
async def edit_message_caption(self, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
974
|
+
"""Use this method to edit captions of messages.
|
|
975
|
+
|
|
976
|
+
https://core.telegram.org/bots/api#editmessagecaption
|
|
977
|
+
"""
|
|
978
|
+
return await self.request("editMessageCaption", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "reply_markup": reply_markup}, 'Message | bool')
|
|
979
|
+
|
|
980
|
+
async def edit_message_media(self, media: InputMedia, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
981
|
+
"""Use this method to edit animation, audio, document, live photo, photo, or video messages, or to replace a text or a rich message with a media.
|
|
982
|
+
|
|
983
|
+
https://core.telegram.org/bots/api#editmessagemedia
|
|
984
|
+
"""
|
|
985
|
+
return await self.request("editMessageMedia", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "media": media, "reply_markup": reply_markup}, 'Message | bool')
|
|
986
|
+
|
|
987
|
+
async def edit_message_live_location(self, latitude: float, longitude: float, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, live_period: int | None = None, horizontal_accuracy: float | None = None, heading: int | None = None, proximity_alert_radius: int | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
988
|
+
"""Use this method to edit live location messages.
|
|
989
|
+
|
|
990
|
+
https://core.telegram.org/bots/api#editmessagelivelocation
|
|
991
|
+
"""
|
|
992
|
+
return await self.request("editMessageLiveLocation", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "latitude": latitude, "longitude": longitude, "live_period": live_period, "horizontal_accuracy": horizontal_accuracy, "heading": heading, "proximity_alert_radius": proximity_alert_radius, "reply_markup": reply_markup}, 'Message | bool')
|
|
993
|
+
|
|
994
|
+
async def stop_message_live_location(self, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
995
|
+
"""Use this method to stop updating a live location message before live_period expires.
|
|
996
|
+
|
|
997
|
+
https://core.telegram.org/bots/api#stopmessagelivelocation
|
|
998
|
+
"""
|
|
999
|
+
return await self.request("stopMessageLiveLocation", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "reply_markup": reply_markup}, 'Message | bool')
|
|
1000
|
+
|
|
1001
|
+
async def edit_message_checklist(self, business_connection_id: str, chat_id: int | str, message_id: int, checklist: InputChecklist, *, reply_markup: InlineKeyboardMarkup | None = None) -> Message:
|
|
1002
|
+
"""Use this method to edit a checklist on behalf of a connected business account.
|
|
1003
|
+
|
|
1004
|
+
https://core.telegram.org/bots/api#editmessagechecklist
|
|
1005
|
+
"""
|
|
1006
|
+
return await self.request("editMessageChecklist", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "checklist": checklist, "reply_markup": reply_markup}, 'Message')
|
|
1007
|
+
|
|
1008
|
+
async def edit_message_reply_markup(self, *, business_connection_id: str | None = None, chat_id: int | str | None = None, message_id: int | None = None, inline_message_id: str | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message | bool:
|
|
1009
|
+
"""Use this method to edit only the reply markup of messages.
|
|
1010
|
+
|
|
1011
|
+
https://core.telegram.org/bots/api#editmessagereplymarkup
|
|
1012
|
+
"""
|
|
1013
|
+
return await self.request("editMessageReplyMarkup", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id, "reply_markup": reply_markup}, 'Message | bool')
|
|
1014
|
+
|
|
1015
|
+
async def stop_poll(self, chat_id: int | str, message_id: int, *, business_connection_id: str | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Poll:
|
|
1016
|
+
"""Use this method to stop a poll which was sent by the bot.
|
|
1017
|
+
|
|
1018
|
+
https://core.telegram.org/bots/api#stoppoll
|
|
1019
|
+
"""
|
|
1020
|
+
return await self.request("stopPoll", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_id": message_id, "reply_markup": reply_markup}, 'Poll')
|
|
1021
|
+
|
|
1022
|
+
async def edit_ephemeral_message_text(self, chat_id: int | str, receiver_user_id: int, ephemeral_message_id: int, *, text: str | None = None, parse_mode: str | None = None, entities: list[MessageEntity] | None = None, rich_message: InputRichMessage | None = None, link_preview_options: LinkPreviewOptions | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> bool:
|
|
1023
|
+
"""Use this method to edit an ephemeral text or rich message.
|
|
1024
|
+
|
|
1025
|
+
https://core.telegram.org/bots/api#editephemeralmessagetext
|
|
1026
|
+
"""
|
|
1027
|
+
return await self.request("editEphemeralMessageText", {"chat_id": chat_id, "receiver_user_id": receiver_user_id, "ephemeral_message_id": ephemeral_message_id, "text": text, "parse_mode": parse_mode, "entities": entities, "rich_message": rich_message, "link_preview_options": link_preview_options, "reply_markup": reply_markup}, 'bool')
|
|
1028
|
+
|
|
1029
|
+
async def edit_ephemeral_message_media(self, chat_id: int | str, receiver_user_id: int, ephemeral_message_id: int, media: InputMedia, *, reply_markup: InlineKeyboardMarkup | None = None) -> bool:
|
|
1030
|
+
"""Use this method to edit the media of an ephemeral message.
|
|
1031
|
+
|
|
1032
|
+
https://core.telegram.org/bots/api#editephemeralmessagemedia
|
|
1033
|
+
"""
|
|
1034
|
+
return await self.request("editEphemeralMessageMedia", {"chat_id": chat_id, "receiver_user_id": receiver_user_id, "ephemeral_message_id": ephemeral_message_id, "media": media, "reply_markup": reply_markup}, 'bool')
|
|
1035
|
+
|
|
1036
|
+
async def edit_ephemeral_message_caption(self, chat_id: int | str, receiver_user_id: int, ephemeral_message_id: int, *, caption: str | None = None, parse_mode: str | None = None, caption_entities: list[MessageEntity] | None = None, show_caption_above_media: bool | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> bool:
|
|
1037
|
+
"""Use this method to edit the caption of an ephemeral message.
|
|
1038
|
+
|
|
1039
|
+
https://core.telegram.org/bots/api#editephemeralmessagecaption
|
|
1040
|
+
"""
|
|
1041
|
+
return await self.request("editEphemeralMessageCaption", {"chat_id": chat_id, "receiver_user_id": receiver_user_id, "ephemeral_message_id": ephemeral_message_id, "caption": caption, "parse_mode": parse_mode, "caption_entities": caption_entities, "show_caption_above_media": show_caption_above_media, "reply_markup": reply_markup}, 'bool')
|
|
1042
|
+
|
|
1043
|
+
async def edit_ephemeral_message_reply_markup(self, chat_id: int | str, receiver_user_id: int, ephemeral_message_id: int, *, reply_markup: InlineKeyboardMarkup | None = None) -> bool:
|
|
1044
|
+
"""Use this method to edit only the reply markup of an ephemeral message.
|
|
1045
|
+
|
|
1046
|
+
https://core.telegram.org/bots/api#editephemeralmessagereplymarkup
|
|
1047
|
+
"""
|
|
1048
|
+
return await self.request("editEphemeralMessageReplyMarkup", {"chat_id": chat_id, "receiver_user_id": receiver_user_id, "ephemeral_message_id": ephemeral_message_id, "reply_markup": reply_markup}, 'bool')
|
|
1049
|
+
|
|
1050
|
+
async def approve_suggested_post(self, chat_id: int, message_id: int, *, send_date: int | None = None) -> bool:
|
|
1051
|
+
"""Use this method to approve a suggested post in a direct messages chat.
|
|
1052
|
+
|
|
1053
|
+
https://core.telegram.org/bots/api#approvesuggestedpost
|
|
1054
|
+
"""
|
|
1055
|
+
return await self.request("approveSuggestedPost", {"chat_id": chat_id, "message_id": message_id, "send_date": send_date}, 'bool')
|
|
1056
|
+
|
|
1057
|
+
async def decline_suggested_post(self, chat_id: int, message_id: int, *, comment: str | None = None) -> bool:
|
|
1058
|
+
"""Use this method to decline a suggested post in a direct messages chat.
|
|
1059
|
+
|
|
1060
|
+
https://core.telegram.org/bots/api#declinesuggestedpost
|
|
1061
|
+
"""
|
|
1062
|
+
return await self.request("declineSuggestedPost", {"chat_id": chat_id, "message_id": message_id, "comment": comment}, 'bool')
|
|
1063
|
+
|
|
1064
|
+
async def delete_message(self, chat_id: int | str, message_id: int) -> bool:
|
|
1065
|
+
"""Use this method to delete a message, including service messages, with the following limitations:.
|
|
1066
|
+
|
|
1067
|
+
https://core.telegram.org/bots/api#deletemessage
|
|
1068
|
+
"""
|
|
1069
|
+
return await self.request("deleteMessage", {"chat_id": chat_id, "message_id": message_id}, 'bool')
|
|
1070
|
+
|
|
1071
|
+
async def delete_messages(self, chat_id: int | str, message_ids: list[int]) -> bool:
|
|
1072
|
+
"""Use this method to delete multiple messages simultaneously.
|
|
1073
|
+
|
|
1074
|
+
https://core.telegram.org/bots/api#deletemessages
|
|
1075
|
+
"""
|
|
1076
|
+
return await self.request("deleteMessages", {"chat_id": chat_id, "message_ids": message_ids}, 'bool')
|
|
1077
|
+
|
|
1078
|
+
async def delete_ephemeral_message(self, chat_id: int | str, receiver_user_id: int, ephemeral_message_id: int) -> bool:
|
|
1079
|
+
"""Use this method to delete an ephemeral message.
|
|
1080
|
+
|
|
1081
|
+
https://core.telegram.org/bots/api#deleteephemeralmessage
|
|
1082
|
+
"""
|
|
1083
|
+
return await self.request("deleteEphemeralMessage", {"chat_id": chat_id, "receiver_user_id": receiver_user_id, "ephemeral_message_id": ephemeral_message_id}, 'bool')
|
|
1084
|
+
|
|
1085
|
+
async def delete_message_reaction(self, chat_id: int | str, message_id: int, *, user_id: int | None = None, actor_chat_id: int | None = None) -> bool:
|
|
1086
|
+
"""Use this method to remove a reaction from a message in a group or a supergroup chat.
|
|
1087
|
+
|
|
1088
|
+
https://core.telegram.org/bots/api#deletemessagereaction
|
|
1089
|
+
"""
|
|
1090
|
+
return await self.request("deleteMessageReaction", {"chat_id": chat_id, "message_id": message_id, "user_id": user_id, "actor_chat_id": actor_chat_id}, 'bool')
|
|
1091
|
+
|
|
1092
|
+
async def delete_all_message_reactions(self, chat_id: int | str, *, user_id: int | None = None, actor_chat_id: int | None = None) -> bool:
|
|
1093
|
+
"""Use this method to remove up to 10000 recent reactions in a group or a supergroup chat added by a given user or chat.
|
|
1094
|
+
|
|
1095
|
+
https://core.telegram.org/bots/api#deleteallmessagereactions
|
|
1096
|
+
"""
|
|
1097
|
+
return await self.request("deleteAllMessageReactions", {"chat_id": chat_id, "user_id": user_id, "actor_chat_id": actor_chat_id}, 'bool')
|
|
1098
|
+
|
|
1099
|
+
async def send_sticker(self, chat_id: int | str, sticker: InputFile | str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, emoji: str | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
1100
|
+
"""Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
|
|
1101
|
+
|
|
1102
|
+
https://core.telegram.org/bots/api#sendsticker
|
|
1103
|
+
"""
|
|
1104
|
+
return await self.request("sendSticker", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "sticker": sticker, "emoji": emoji, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
1105
|
+
|
|
1106
|
+
async def get_sticker_set(self, name: str) -> StickerSet:
|
|
1107
|
+
"""Use this method to get a sticker set.
|
|
1108
|
+
|
|
1109
|
+
https://core.telegram.org/bots/api#getstickerset
|
|
1110
|
+
"""
|
|
1111
|
+
return await self.request("getStickerSet", {"name": name}, 'StickerSet')
|
|
1112
|
+
|
|
1113
|
+
async def get_custom_emoji_stickers(self, custom_emoji_ids: list[str]) -> list[Sticker]:
|
|
1114
|
+
"""Use this method to get information about custom emoji stickers by their identifiers.
|
|
1115
|
+
|
|
1116
|
+
https://core.telegram.org/bots/api#getcustomemojistickers
|
|
1117
|
+
"""
|
|
1118
|
+
return await self.request("getCustomEmojiStickers", {"custom_emoji_ids": custom_emoji_ids}, 'list[Sticker]')
|
|
1119
|
+
|
|
1120
|
+
async def upload_sticker_file(self, user_id: int, sticker: InputFile, sticker_format: str) -> File:
|
|
1121
|
+
"""Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times).
|
|
1122
|
+
|
|
1123
|
+
https://core.telegram.org/bots/api#uploadstickerfile
|
|
1124
|
+
"""
|
|
1125
|
+
return await self.request("uploadStickerFile", {"user_id": user_id, "sticker": sticker, "sticker_format": sticker_format}, 'File')
|
|
1126
|
+
|
|
1127
|
+
async def create_new_sticker_set(self, user_id: int, name: str, title: str, stickers: list[InputSticker], *, sticker_type: str | None = None, needs_repainting: bool | None = None) -> bool:
|
|
1128
|
+
"""Use this method to create a new sticker set owned by a user.
|
|
1129
|
+
|
|
1130
|
+
https://core.telegram.org/bots/api#createnewstickerset
|
|
1131
|
+
"""
|
|
1132
|
+
return await self.request("createNewStickerSet", {"user_id": user_id, "name": name, "title": title, "stickers": stickers, "sticker_type": sticker_type, "needs_repainting": needs_repainting}, 'bool')
|
|
1133
|
+
|
|
1134
|
+
async def add_sticker_to_set(self, user_id: int, name: str, sticker: InputSticker) -> bool:
|
|
1135
|
+
"""Use this method to add a new sticker to a set created by the bot.
|
|
1136
|
+
|
|
1137
|
+
https://core.telegram.org/bots/api#addstickertoset
|
|
1138
|
+
"""
|
|
1139
|
+
return await self.request("addStickerToSet", {"user_id": user_id, "name": name, "sticker": sticker}, 'bool')
|
|
1140
|
+
|
|
1141
|
+
async def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
|
1142
|
+
"""Use this method to move a sticker in a set created by the bot to a specific position.
|
|
1143
|
+
|
|
1144
|
+
https://core.telegram.org/bots/api#setstickerpositioninset
|
|
1145
|
+
"""
|
|
1146
|
+
return await self.request("setStickerPositionInSet", {"sticker": sticker, "position": position}, 'bool')
|
|
1147
|
+
|
|
1148
|
+
async def delete_sticker_from_set(self, sticker: str) -> bool:
|
|
1149
|
+
"""Use this method to delete a sticker from a set created by the bot.
|
|
1150
|
+
|
|
1151
|
+
https://core.telegram.org/bots/api#deletestickerfromset
|
|
1152
|
+
"""
|
|
1153
|
+
return await self.request("deleteStickerFromSet", {"sticker": sticker}, 'bool')
|
|
1154
|
+
|
|
1155
|
+
async def replace_sticker_in_set(self, user_id: int, name: str, old_sticker: str, sticker: InputSticker) -> bool:
|
|
1156
|
+
"""Use this method to replace an existing sticker in a sticker set with a new one.
|
|
1157
|
+
|
|
1158
|
+
https://core.telegram.org/bots/api#replacestickerinset
|
|
1159
|
+
"""
|
|
1160
|
+
return await self.request("replaceStickerInSet", {"user_id": user_id, "name": name, "old_sticker": old_sticker, "sticker": sticker}, 'bool')
|
|
1161
|
+
|
|
1162
|
+
async def set_sticker_emoji_list(self, sticker: str, emoji_list: list[str]) -> bool:
|
|
1163
|
+
"""Use this method to change the list of emoji assigned to a regular or custom emoji sticker.
|
|
1164
|
+
|
|
1165
|
+
https://core.telegram.org/bots/api#setstickeremojilist
|
|
1166
|
+
"""
|
|
1167
|
+
return await self.request("setStickerEmojiList", {"sticker": sticker, "emoji_list": emoji_list}, 'bool')
|
|
1168
|
+
|
|
1169
|
+
async def set_sticker_keywords(self, sticker: str, *, keywords: list[str] | None = None) -> bool:
|
|
1170
|
+
"""Use this method to change search keywords assigned to a regular or custom emoji sticker.
|
|
1171
|
+
|
|
1172
|
+
https://core.telegram.org/bots/api#setstickerkeywords
|
|
1173
|
+
"""
|
|
1174
|
+
return await self.request("setStickerKeywords", {"sticker": sticker, "keywords": keywords}, 'bool')
|
|
1175
|
+
|
|
1176
|
+
async def set_sticker_mask_position(self, sticker: str, *, mask_position: MaskPosition | None = None) -> bool:
|
|
1177
|
+
"""Use this method to change the mask position of a mask sticker.
|
|
1178
|
+
|
|
1179
|
+
https://core.telegram.org/bots/api#setstickermaskposition
|
|
1180
|
+
"""
|
|
1181
|
+
return await self.request("setStickerMaskPosition", {"sticker": sticker, "mask_position": mask_position}, 'bool')
|
|
1182
|
+
|
|
1183
|
+
async def set_sticker_set_title(self, name: str, title: str) -> bool:
|
|
1184
|
+
"""Use this method to set the title of a created sticker set.
|
|
1185
|
+
|
|
1186
|
+
https://core.telegram.org/bots/api#setstickersettitle
|
|
1187
|
+
"""
|
|
1188
|
+
return await self.request("setStickerSetTitle", {"name": name, "title": title}, 'bool')
|
|
1189
|
+
|
|
1190
|
+
async def set_sticker_set_thumbnail(self, name: str, user_id: int, format: str, *, thumbnail: InputFile | str | None = None) -> bool:
|
|
1191
|
+
"""Use this method to set the thumbnail of a regular or mask sticker set.
|
|
1192
|
+
|
|
1193
|
+
https://core.telegram.org/bots/api#setstickersetthumbnail
|
|
1194
|
+
"""
|
|
1195
|
+
return await self.request("setStickerSetThumbnail", {"name": name, "user_id": user_id, "thumbnail": thumbnail, "format": format}, 'bool')
|
|
1196
|
+
|
|
1197
|
+
async def set_custom_emoji_sticker_set_thumbnail(self, name: str, *, custom_emoji_id: str | None = None) -> bool:
|
|
1198
|
+
"""Use this method to set the thumbnail of a custom emoji sticker set.
|
|
1199
|
+
|
|
1200
|
+
https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
|
|
1201
|
+
"""
|
|
1202
|
+
return await self.request("setCustomEmojiStickerSetThumbnail", {"name": name, "custom_emoji_id": custom_emoji_id}, 'bool')
|
|
1203
|
+
|
|
1204
|
+
async def delete_sticker_set(self, name: str) -> bool:
|
|
1205
|
+
"""Use this method to delete a sticker set that was created by the bot.
|
|
1206
|
+
|
|
1207
|
+
https://core.telegram.org/bots/api#deletestickerset
|
|
1208
|
+
"""
|
|
1209
|
+
return await self.request("deleteStickerSet", {"name": name}, 'bool')
|
|
1210
|
+
|
|
1211
|
+
async def send_rich_message(self, chat_id: int | str, rich_message: InputRichMessage, *, business_connection_id: str | None = None, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, ephemeral_message_parameters: EphemeralMessageParameters | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None) -> Message:
|
|
1212
|
+
"""Use this method to send rich messages.
|
|
1213
|
+
|
|
1214
|
+
https://core.telegram.org/bots/api#sendrichmessage
|
|
1215
|
+
"""
|
|
1216
|
+
return await self.request("sendRichMessage", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "ephemeral_message_parameters": ephemeral_message_parameters, "rich_message": rich_message, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
1217
|
+
|
|
1218
|
+
async def send_rich_message_draft(self, chat_id: int, draft_id: int, rich_message: InputRichMessage, *, message_thread_id: int | None = None, can_stop: bool | None = None, keep_on_stop: bool | None = None) -> bool:
|
|
1219
|
+
"""Use this method to stream a partial rich message to a user while the message is being generated.
|
|
1220
|
+
|
|
1221
|
+
https://core.telegram.org/bots/api#sendrichmessagedraft
|
|
1222
|
+
"""
|
|
1223
|
+
return await self.request("sendRichMessageDraft", {"chat_id": chat_id, "message_thread_id": message_thread_id, "draft_id": draft_id, "rich_message": rich_message, "can_stop": can_stop, "keep_on_stop": keep_on_stop}, 'bool')
|
|
1224
|
+
|
|
1225
|
+
async def answer_inline_query(self, inline_query_id: str, results: list[InlineQueryResult], *, cache_time: int | None = None, is_personal: bool | None = None, next_offset: str | None = None, button: InlineQueryResultsButton | None = None) -> bool:
|
|
1226
|
+
"""Use this method to send answers to an inline query.
|
|
1227
|
+
|
|
1228
|
+
https://core.telegram.org/bots/api#answerinlinequery
|
|
1229
|
+
"""
|
|
1230
|
+
return await self.request("answerInlineQuery", {"inline_query_id": inline_query_id, "results": results, "cache_time": cache_time, "is_personal": is_personal, "next_offset": next_offset, "button": button}, 'bool')
|
|
1231
|
+
|
|
1232
|
+
async def send_invoice(self, chat_id: int | str, title: str, description: str, payload: str, currency: str, prices: list[LabeledPrice], *, message_thread_id: int | None = None, direct_messages_topic_id: int | None = None, provider_token: str | None = None, max_tip_amount: int | None = None, suggested_tip_amounts: list[int] | None = None, start_parameter: str | None = None, provider_data: str | None = None, photo_url: str | None = None, photo_size: int | None = None, photo_width: int | None = None, photo_height: int | None = None, need_name: bool | None = None, need_phone_number: bool | None = None, need_email: bool | None = None, need_shipping_address: bool | None = None, send_phone_number_to_provider: bool | None = None, send_email_to_provider: bool | None = None, is_flexible: bool | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, suggested_post_parameters: SuggestedPostParameters | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message:
|
|
1233
|
+
"""Use this method to send invoices.
|
|
1234
|
+
|
|
1235
|
+
https://core.telegram.org/bots/api#sendinvoice
|
|
1236
|
+
"""
|
|
1237
|
+
return await self.request("sendInvoice", {"chat_id": chat_id, "message_thread_id": message_thread_id, "direct_messages_topic_id": direct_messages_topic_id, "title": title, "description": description, "payload": payload, "provider_token": provider_token, "currency": currency, "prices": prices, "max_tip_amount": max_tip_amount, "suggested_tip_amounts": suggested_tip_amounts, "start_parameter": start_parameter, "provider_data": provider_data, "photo_url": photo_url, "photo_size": photo_size, "photo_width": photo_width, "photo_height": photo_height, "need_name": need_name, "need_phone_number": need_phone_number, "need_email": need_email, "need_shipping_address": need_shipping_address, "send_phone_number_to_provider": send_phone_number_to_provider, "send_email_to_provider": send_email_to_provider, "is_flexible": is_flexible, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "suggested_post_parameters": suggested_post_parameters, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
1238
|
+
|
|
1239
|
+
async def create_invoice_link(self, title: str, description: str, payload: str, currency: str, prices: list[LabeledPrice], *, business_connection_id: str | None = None, provider_token: str | None = None, subscription_period: int | None = None, max_tip_amount: int | None = None, suggested_tip_amounts: list[int] | None = None, provider_data: str | None = None, photo_url: str | None = None, photo_size: int | None = None, photo_width: int | None = None, photo_height: int | None = None, need_name: bool | None = None, need_phone_number: bool | None = None, need_email: bool | None = None, need_shipping_address: bool | None = None, send_phone_number_to_provider: bool | None = None, send_email_to_provider: bool | None = None, is_flexible: bool | None = None) -> str:
|
|
1240
|
+
"""Use this method to create a link for an invoice.
|
|
1241
|
+
|
|
1242
|
+
https://core.telegram.org/bots/api#createinvoicelink
|
|
1243
|
+
"""
|
|
1244
|
+
return await self.request("createInvoiceLink", {"business_connection_id": business_connection_id, "title": title, "description": description, "payload": payload, "provider_token": provider_token, "currency": currency, "prices": prices, "subscription_period": subscription_period, "max_tip_amount": max_tip_amount, "suggested_tip_amounts": suggested_tip_amounts, "provider_data": provider_data, "photo_url": photo_url, "photo_size": photo_size, "photo_width": photo_width, "photo_height": photo_height, "need_name": need_name, "need_phone_number": need_phone_number, "need_email": need_email, "need_shipping_address": need_shipping_address, "send_phone_number_to_provider": send_phone_number_to_provider, "send_email_to_provider": send_email_to_provider, "is_flexible": is_flexible}, 'str')
|
|
1245
|
+
|
|
1246
|
+
async def answer_shipping_query(self, shipping_query_id: str, ok: bool, *, shipping_options: list[ShippingOption] | None = None, error_message: str | None = None) -> bool:
|
|
1247
|
+
"""If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot.
|
|
1248
|
+
|
|
1249
|
+
https://core.telegram.org/bots/api#answershippingquery
|
|
1250
|
+
"""
|
|
1251
|
+
return await self.request("answerShippingQuery", {"shipping_query_id": shipping_query_id, "ok": ok, "shipping_options": shipping_options, "error_message": error_message}, 'bool')
|
|
1252
|
+
|
|
1253
|
+
async def answer_pre_checkout_query(self, pre_checkout_query_id: str, ok: bool, *, error_message: str | None = None) -> bool:
|
|
1254
|
+
"""Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query.
|
|
1255
|
+
|
|
1256
|
+
https://core.telegram.org/bots/api#answerprecheckoutquery
|
|
1257
|
+
"""
|
|
1258
|
+
return await self.request("answerPreCheckoutQuery", {"pre_checkout_query_id": pre_checkout_query_id, "ok": ok, "error_message": error_message}, 'bool')
|
|
1259
|
+
|
|
1260
|
+
async def get_my_star_balance(self) -> StarAmount:
|
|
1261
|
+
"""A method to get the current Telegram Stars balance of the bot.
|
|
1262
|
+
|
|
1263
|
+
https://core.telegram.org/bots/api#getmystarbalance
|
|
1264
|
+
"""
|
|
1265
|
+
return await self.request("getMyStarBalance", {}, 'StarAmount')
|
|
1266
|
+
|
|
1267
|
+
async def get_star_transactions(self, *, offset: int | None = None, limit: int | None = None) -> StarTransactions:
|
|
1268
|
+
"""Returns the bot's Telegram Star transactions in chronological order.
|
|
1269
|
+
|
|
1270
|
+
https://core.telegram.org/bots/api#getstartransactions
|
|
1271
|
+
"""
|
|
1272
|
+
return await self.request("getStarTransactions", {"offset": offset, "limit": limit}, 'StarTransactions')
|
|
1273
|
+
|
|
1274
|
+
async def refund_star_payment(self, user_id: int, telegram_payment_charge_id: str) -> bool:
|
|
1275
|
+
"""Refunds a successful payment in Telegram Stars.
|
|
1276
|
+
|
|
1277
|
+
https://core.telegram.org/bots/api#refundstarpayment
|
|
1278
|
+
"""
|
|
1279
|
+
return await self.request("refundStarPayment", {"user_id": user_id, "telegram_payment_charge_id": telegram_payment_charge_id}, 'bool')
|
|
1280
|
+
|
|
1281
|
+
async def edit_user_star_subscription(self, user_id: int, telegram_payment_charge_id: str, is_canceled: bool) -> bool:
|
|
1282
|
+
"""Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.
|
|
1283
|
+
|
|
1284
|
+
https://core.telegram.org/bots/api#edituserstarsubscription
|
|
1285
|
+
"""
|
|
1286
|
+
return await self.request("editUserStarSubscription", {"user_id": user_id, "telegram_payment_charge_id": telegram_payment_charge_id, "is_canceled": is_canceled}, 'bool')
|
|
1287
|
+
|
|
1288
|
+
async def set_passport_data_errors(self, user_id: int, errors: list[PassportElementError]) -> bool:
|
|
1289
|
+
"""Informs a user that some of the Telegram Passport elements they provided contains errors.
|
|
1290
|
+
|
|
1291
|
+
https://core.telegram.org/bots/api#setpassportdataerrors
|
|
1292
|
+
"""
|
|
1293
|
+
return await self.request("setPassportDataErrors", {"user_id": user_id, "errors": errors}, 'bool')
|
|
1294
|
+
|
|
1295
|
+
async def send_game(self, chat_id: int | str, game_short_name: str, *, business_connection_id: str | None = None, message_thread_id: int | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, allow_paid_broadcast: bool | None = None, message_effect_id: str | None = None, reply_parameters: ReplyParameters | None = None, reply_markup: InlineKeyboardMarkup | None = None) -> Message:
|
|
1296
|
+
"""Use this method to send a game.
|
|
1297
|
+
|
|
1298
|
+
https://core.telegram.org/bots/api#sendgame
|
|
1299
|
+
"""
|
|
1300
|
+
return await self.request("sendGame", {"business_connection_id": business_connection_id, "chat_id": chat_id, "message_thread_id": message_thread_id, "game_short_name": game_short_name, "disable_notification": disable_notification, "protect_content": protect_content, "allow_paid_broadcast": allow_paid_broadcast, "message_effect_id": message_effect_id, "reply_parameters": reply_parameters, "reply_markup": reply_markup}, 'Message')
|
|
1301
|
+
|
|
1302
|
+
async def set_game_score(self, user_id: int, score: int, *, force: bool | None = None, disable_edit_message: bool | None = None, chat_id: int | None = None, message_id: int | None = None, inline_message_id: str | None = None) -> Message | bool:
|
|
1303
|
+
"""Use this method to set the score of the specified user in a game message.
|
|
1304
|
+
|
|
1305
|
+
https://core.telegram.org/bots/api#setgamescore
|
|
1306
|
+
"""
|
|
1307
|
+
return await self.request("setGameScore", {"user_id": user_id, "score": score, "force": force, "disable_edit_message": disable_edit_message, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id}, 'Message | bool')
|
|
1308
|
+
|
|
1309
|
+
async def get_game_high_scores(self, user_id: int, *, chat_id: int | None = None, message_id: int | None = None, inline_message_id: str | None = None) -> list[GameHighScore]:
|
|
1310
|
+
"""Use this method to get data for high score tables.
|
|
1311
|
+
|
|
1312
|
+
https://core.telegram.org/bots/api#getgamehighscores
|
|
1313
|
+
"""
|
|
1314
|
+
return await self.request("getGameHighScores", {"user_id": user_id, "chat_id": chat_id, "message_id": message_id, "inline_message_id": inline_message_id}, 'list[GameHighScore]')
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
METHOD_COUNT = 185
|