ng-bot-api 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.
- ng_bot_api/__init__.py +56 -0
- ng_bot_api/api_version.py +2 -0
- ng_bot_api/async_bot.py +97 -0
- ng_bot_api/core/__init__.py +31 -0
- ng_bot_api/core/base.py +36 -0
- ng_bot_api/core/caller.py +17 -0
- ng_bot_api/core/decoding.py +85 -0
- ng_bot_api/core/encoding.py +42 -0
- ng_bot_api/core/errors.py +75 -0
- ng_bot_api/core/input_file.py +56 -0
- ng_bot_api/core/polling.py +39 -0
- ng_bot_api/core/registry.py +72 -0
- ng_bot_api/core/request.py +67 -0
- ng_bot_api/core/typespec.py +57 -0
- ng_bot_api/dispatcher/__init__.py +17 -0
- ng_bot_api/dispatcher/dispatcher.py +95 -0
- ng_bot_api/dispatcher/filter_base.py +78 -0
- ng_bot_api/dispatcher/filters.py +124 -0
- ng_bot_api/dispatcher/handler.py +34 -0
- ng_bot_api/dispatcher/router.py +69 -0
- ng_bot_api/methods/__init__.py +115 -0
- ng_bot_api/methods/async_01.py +99 -0
- ng_bot_api/methods/async_02.py +114 -0
- ng_bot_api/methods/async_03.py +85 -0
- ng_bot_api/methods/async_04.py +110 -0
- ng_bot_api/methods/async_05.py +114 -0
- ng_bot_api/methods/async_06.py +74 -0
- ng_bot_api/methods/async_07.py +114 -0
- ng_bot_api/methods/async_08.py +106 -0
- ng_bot_api/methods/async_09.py +97 -0
- ng_bot_api/methods/async_10.py +92 -0
- ng_bot_api/methods/async_11.py +107 -0
- ng_bot_api/methods/async_12.py +119 -0
- ng_bot_api/methods/async_13.py +119 -0
- ng_bot_api/methods/async_14.py +113 -0
- ng_bot_api/methods/async_15.py +117 -0
- ng_bot_api/methods/async_16.py +115 -0
- ng_bot_api/methods/async_17.py +121 -0
- ng_bot_api/methods/async_18.py +118 -0
- ng_bot_api/methods/async_19.py +128 -0
- ng_bot_api/methods/async_20.py +115 -0
- ng_bot_api/methods/async_21.py +127 -0
- ng_bot_api/methods/async_22.py +110 -0
- ng_bot_api/methods/async_23.py +116 -0
- ng_bot_api/methods/async_24.py +118 -0
- ng_bot_api/methods/async_25.py +109 -0
- ng_bot_api/methods/async_26.py +124 -0
- ng_bot_api/methods/async_27.py +119 -0
- ng_bot_api/methods/async_28.py +119 -0
- ng_bot_api/methods/async_29.py +108 -0
- ng_bot_api/methods/async_30.py +115 -0
- ng_bot_api/methods/async_31.py +112 -0
- ng_bot_api/methods/async_32.py +126 -0
- ng_bot_api/methods/async_33.py +105 -0
- ng_bot_api/methods/async_34.py +117 -0
- ng_bot_api/methods/async_35.py +122 -0
- ng_bot_api/methods/async_36.py +121 -0
- ng_bot_api/methods/async_37.py +126 -0
- ng_bot_api/methods/async_38.py +112 -0
- ng_bot_api/methods/async_39.py +84 -0
- ng_bot_api/methods/async_40.py +125 -0
- ng_bot_api/methods/async_41.py +115 -0
- ng_bot_api/methods/async_42.py +30 -0
- ng_bot_api/methods/sync_01.py +99 -0
- ng_bot_api/methods/sync_02.py +114 -0
- ng_bot_api/methods/sync_03.py +85 -0
- ng_bot_api/methods/sync_04.py +110 -0
- ng_bot_api/methods/sync_05.py +114 -0
- ng_bot_api/methods/sync_06.py +74 -0
- ng_bot_api/methods/sync_07.py +114 -0
- ng_bot_api/methods/sync_08.py +106 -0
- ng_bot_api/methods/sync_09.py +97 -0
- ng_bot_api/methods/sync_10.py +92 -0
- ng_bot_api/methods/sync_11.py +107 -0
- ng_bot_api/methods/sync_12.py +119 -0
- ng_bot_api/methods/sync_13.py +119 -0
- ng_bot_api/methods/sync_14.py +113 -0
- ng_bot_api/methods/sync_15.py +117 -0
- ng_bot_api/methods/sync_16.py +115 -0
- ng_bot_api/methods/sync_17.py +121 -0
- ng_bot_api/methods/sync_18.py +118 -0
- ng_bot_api/methods/sync_19.py +128 -0
- ng_bot_api/methods/sync_20.py +115 -0
- ng_bot_api/methods/sync_21.py +127 -0
- ng_bot_api/methods/sync_22.py +110 -0
- ng_bot_api/methods/sync_23.py +116 -0
- ng_bot_api/methods/sync_24.py +118 -0
- ng_bot_api/methods/sync_25.py +109 -0
- ng_bot_api/methods/sync_26.py +124 -0
- ng_bot_api/methods/sync_27.py +119 -0
- ng_bot_api/methods/sync_28.py +119 -0
- ng_bot_api/methods/sync_29.py +108 -0
- ng_bot_api/methods/sync_30.py +115 -0
- ng_bot_api/methods/sync_31.py +112 -0
- ng_bot_api/methods/sync_32.py +126 -0
- ng_bot_api/methods/sync_33.py +105 -0
- ng_bot_api/methods/sync_34.py +117 -0
- ng_bot_api/methods/sync_35.py +122 -0
- ng_bot_api/methods/sync_36.py +121 -0
- ng_bot_api/methods/sync_37.py +126 -0
- ng_bot_api/methods/sync_38.py +112 -0
- ng_bot_api/methods/sync_39.py +84 -0
- ng_bot_api/methods/sync_40.py +125 -0
- ng_bot_api/methods/sync_41.py +115 -0
- ng_bot_api/methods/sync_42.py +30 -0
- ng_bot_api/py.typed +0 -0
- ng_bot_api/sync_bot.py +95 -0
- ng_bot_api/types/__init__.py +82 -0
- ng_bot_api/types/available_types_01.py +102 -0
- ng_bot_api/types/available_types_02.py +141 -0
- ng_bot_api/types/available_types_03.py +311 -0
- ng_bot_api/types/available_types_04.py +84 -0
- ng_bot_api/types/available_types_05.py +134 -0
- ng_bot_api/types/available_types_06.py +126 -0
- ng_bot_api/types/available_types_07.py +119 -0
- ng_bot_api/types/available_types_08.py +120 -0
- ng_bot_api/types/available_types_09.py +115 -0
- ng_bot_api/types/available_types_10.py +109 -0
- ng_bot_api/types/available_types_11.py +121 -0
- ng_bot_api/types/available_types_12.py +120 -0
- ng_bot_api/types/available_types_13.py +128 -0
- ng_bot_api/types/available_types_14.py +124 -0
- ng_bot_api/types/available_types_15.py +129 -0
- ng_bot_api/types/available_types_16.py +121 -0
- ng_bot_api/types/available_types_17.py +124 -0
- ng_bot_api/types/available_types_18.py +128 -0
- ng_bot_api/types/available_types_19.py +115 -0
- ng_bot_api/types/available_types_20.py +123 -0
- ng_bot_api/types/available_types_21.py +101 -0
- ng_bot_api/types/available_types_22.py +121 -0
- ng_bot_api/types/available_types_23.py +128 -0
- ng_bot_api/types/available_types_24.py +107 -0
- ng_bot_api/types/available_types_25.py +100 -0
- ng_bot_api/types/available_types_26.py +81 -0
- ng_bot_api/types/available_types_27.py +114 -0
- ng_bot_api/types/available_types_28.py +125 -0
- ng_bot_api/types/available_types_29.py +118 -0
- ng_bot_api/types/available_types_30.py +113 -0
- ng_bot_api/types/available_types_31.py +120 -0
- ng_bot_api/types/available_types_32.py +124 -0
- ng_bot_api/types/available_types_33.py +125 -0
- ng_bot_api/types/available_types_34.py +113 -0
- ng_bot_api/types/available_types_35.py +125 -0
- ng_bot_api/types/available_types_36.py +119 -0
- ng_bot_api/types/available_types_37.py +126 -0
- ng_bot_api/types/available_types_38.py +118 -0
- ng_bot_api/types/available_types_39.py +121 -0
- ng_bot_api/types/available_types_40.py +121 -0
- ng_bot_api/types/available_types_41.py +116 -0
- ng_bot_api/types/available_types_42.py +112 -0
- ng_bot_api/types/available_types_43.py +110 -0
- ng_bot_api/types/available_types_44.py +30 -0
- ng_bot_api/types/games_01.py +57 -0
- ng_bot_api/types/getting_updates_01.py +123 -0
- ng_bot_api/types/inline_mode_01.py +124 -0
- ng_bot_api/types/inline_mode_02.py +91 -0
- ng_bot_api/types/inline_mode_03.py +116 -0
- ng_bot_api/types/inline_mode_04.py +126 -0
- ng_bot_api/types/inline_mode_05.py +124 -0
- ng_bot_api/types/inline_mode_06.py +124 -0
- ng_bot_api/types/inline_mode_07.py +119 -0
- ng_bot_api/types/inline_mode_08.py +104 -0
- ng_bot_api/types/inline_mode_09.py +84 -0
- ng_bot_api/types/payments_01.py +124 -0
- ng_bot_api/types/payments_02.py +124 -0
- ng_bot_api/types/payments_03.py +119 -0
- ng_bot_api/types/payments_04.py +70 -0
- ng_bot_api/types/rich_messages_01.py +126 -0
- ng_bot_api/types/rich_messages_02.py +125 -0
- ng_bot_api/types/rich_messages_03.py +115 -0
- ng_bot_api/types/rich_messages_04.py +116 -0
- ng_bot_api/types/rich_messages_05.py +128 -0
- ng_bot_api/types/rich_messages_06.py +125 -0
- ng_bot_api/types/rich_messages_07.py +114 -0
- ng_bot_api/types/rich_messages_08.py +118 -0
- ng_bot_api/types/rich_messages_09.py +124 -0
- ng_bot_api/types/rich_messages_10.py +125 -0
- ng_bot_api/types/rich_messages_11.py +122 -0
- ng_bot_api/types/rich_messages_12.py +122 -0
- ng_bot_api/types/stickers_01.py +107 -0
- ng_bot_api/types/telegram_passport_01.py +120 -0
- ng_bot_api/types/telegram_passport_02.py +113 -0
- ng_bot_api/types/telegram_passport_03.py +24 -0
- ng_bot_api/types/unions_01.py +140 -0
- ng_bot_api/types/unions_02.py +132 -0
- ng_bot_api/types/unions_03.py +134 -0
- ng_bot_api/types/unions_04.py +149 -0
- ng_bot_api/types/unions_05.py +96 -0
- ng_bot_api/webhook.py +78 -0
- ng_bot_api-0.1.0.dist-info/METADATA +179 -0
- ng_bot_api-0.1.0.dist-info/RECORD +193 -0
- ng_bot_api-0.1.0.dist-info/WHEEL +4 -0
- ng_bot_api-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.caller import AsyncCaller
|
|
4
|
+
from ..types import (
|
|
5
|
+
ForceReply, InlineKeyboardMarkup, InputChecklist, InputPollMedia, InputPollOption, Message,
|
|
6
|
+
MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyParameters,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AsyncMethods12(AsyncCaller):
|
|
11
|
+
__slots__ = ()
|
|
12
|
+
|
|
13
|
+
async def send_poll(
|
|
14
|
+
self,
|
|
15
|
+
chat_id: int | str,
|
|
16
|
+
question: str,
|
|
17
|
+
options: list[InputPollOption],
|
|
18
|
+
*,
|
|
19
|
+
business_connection_id: str | None = None,
|
|
20
|
+
message_thread_id: int | None = None,
|
|
21
|
+
question_parse_mode: str | None = None,
|
|
22
|
+
question_entities: list[MessageEntity] | None = None,
|
|
23
|
+
is_anonymous: bool | None = None,
|
|
24
|
+
type: str | None = None,
|
|
25
|
+
allows_multiple_answers: bool | None = None,
|
|
26
|
+
allows_revoting: bool | None = None,
|
|
27
|
+
shuffle_options: bool | None = None,
|
|
28
|
+
allow_adding_options: bool | None = None,
|
|
29
|
+
hide_results_until_closes: bool | None = None,
|
|
30
|
+
members_only: bool | None = None,
|
|
31
|
+
country_codes: list[str] | None = None,
|
|
32
|
+
correct_option_ids: list[int] | None = None,
|
|
33
|
+
explanation: str | None = None,
|
|
34
|
+
explanation_parse_mode: str | None = None,
|
|
35
|
+
explanation_entities: list[MessageEntity] | None = None,
|
|
36
|
+
explanation_media: InputPollMedia | None = None,
|
|
37
|
+
open_period: int | None = None,
|
|
38
|
+
close_date: int | None = None,
|
|
39
|
+
is_closed: bool | None = None,
|
|
40
|
+
description: str | None = None,
|
|
41
|
+
description_parse_mode: str | None = None,
|
|
42
|
+
description_entities: list[MessageEntity] | None = None,
|
|
43
|
+
media: InputPollMedia | None = None,
|
|
44
|
+
disable_notification: bool | None = None,
|
|
45
|
+
protect_content: bool | None = None,
|
|
46
|
+
allow_paid_broadcast: bool | None = None,
|
|
47
|
+
message_effect_id: str | None = None,
|
|
48
|
+
reply_parameters: ReplyParameters | None = None,
|
|
49
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
50
|
+
) -> Message:
|
|
51
|
+
"""Use this method to send a native poll. On success, the sent Message is returned.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
|
|
55
|
+
chat_id: Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username. Polls can't be sent to channel direct messages chats.
|
|
56
|
+
message_thread_id: Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
|
|
57
|
+
question: Poll question, 1-300 characters
|
|
58
|
+
question_parse_mode: Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed.
|
|
59
|
+
question_entities: A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode.
|
|
60
|
+
options: A JSON-serialized list of 1-12 answer options
|
|
61
|
+
is_anonymous: True, if the poll needs to be anonymous, defaults to True
|
|
62
|
+
type: Poll type, “quiz” or “regular”, defaults to “regular”
|
|
63
|
+
allows_multiple_answers: Pass True if the poll allows multiple answers, defaults to False
|
|
64
|
+
allows_revoting: Pass True if the poll allows changing the chosen answer options, defaults to False for quizzes and to True for regular polls
|
|
65
|
+
shuffle_options: Pass True if the poll options must be shown in random order
|
|
66
|
+
allow_adding_options: Pass True if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes
|
|
67
|
+
hide_results_until_closes: Pass True if poll results must be shown only after the poll closes
|
|
68
|
+
members_only: Pass True if voting is limited to users who have been members of the chat where the poll is being sent for more than 24 hours; for channel chats only
|
|
69
|
+
country_codes: A JSON-serialized list of 0-12 two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which users can vote in the poll; for channel chats only. Use “FT” as a country code to allow users with anonymous numbers to vote. If omitted or empty, then users from any country can participate in the poll.
|
|
70
|
+
correct_option_ids: A JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode
|
|
71
|
+
explanation: Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
|
|
72
|
+
explanation_parse_mode: Mode for parsing entities in the explanation. See formatting options for more details.
|
|
73
|
+
explanation_entities: A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode.
|
|
74
|
+
explanation_media: Media added to the quiz explanation
|
|
75
|
+
open_period: Amount of time in seconds the poll will be active after creation, 5-2628000. Can't be used together with close_date.
|
|
76
|
+
close_date: Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period.
|
|
77
|
+
is_closed: Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
|
|
78
|
+
description: Description of the poll to be sent, 0-1024 characters after entities parsing
|
|
79
|
+
description_parse_mode: Mode for parsing entities in the poll description. See formatting options for more details.
|
|
80
|
+
description_entities: A JSON-serialized list of special entities that appear in the poll description, which can be specified instead of description_parse_mode
|
|
81
|
+
media: Media added to the poll description
|
|
82
|
+
disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
|
83
|
+
protect_content: Protects the contents of the sent message from forwarding and saving
|
|
84
|
+
allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
|
|
85
|
+
message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
|
|
86
|
+
reply_parameters: Description of the message to reply to
|
|
87
|
+
reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
|
|
88
|
+
|
|
89
|
+
https://core.telegram.org/bots/api#sendpoll
|
|
90
|
+
"""
|
|
91
|
+
return await self._call('sendPoll', locals(), 'Message')
|
|
92
|
+
|
|
93
|
+
async def send_checklist(
|
|
94
|
+
self,
|
|
95
|
+
business_connection_id: str,
|
|
96
|
+
chat_id: int | str,
|
|
97
|
+
checklist: InputChecklist,
|
|
98
|
+
*,
|
|
99
|
+
disable_notification: bool | None = None,
|
|
100
|
+
protect_content: bool | None = None,
|
|
101
|
+
message_effect_id: str | None = None,
|
|
102
|
+
reply_parameters: ReplyParameters | None = None,
|
|
103
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
104
|
+
) -> Message:
|
|
105
|
+
"""Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
|
|
109
|
+
chat_id: Unique identifier for the target chat or username of the target bot in the format @username
|
|
110
|
+
checklist: A JSON-serialized object for the checklist to send
|
|
111
|
+
disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
|
112
|
+
protect_content: Protects the contents of the sent message from forwarding and saving
|
|
113
|
+
message_effect_id: Unique identifier of the message effect to be added to the message
|
|
114
|
+
reply_parameters: A JSON-serialized object for description of the message to reply to
|
|
115
|
+
reply_markup: A JSON-serialized object for an inline keyboard
|
|
116
|
+
|
|
117
|
+
https://core.telegram.org/bots/api#sendchecklist
|
|
118
|
+
"""
|
|
119
|
+
return await self._call('sendChecklist', locals(), 'Message')
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.caller import AsyncCaller
|
|
4
|
+
from ..types import (
|
|
5
|
+
ForceReply, InlineKeyboardMarkup, Message, MessageEntity, ReactionType, ReplyKeyboardMarkup,
|
|
6
|
+
ReplyKeyboardRemove, ReplyParameters, SuggestedPostParameters,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AsyncMethods13(AsyncCaller):
|
|
11
|
+
__slots__ = ()
|
|
12
|
+
|
|
13
|
+
async def send_dice(
|
|
14
|
+
self,
|
|
15
|
+
chat_id: int | str,
|
|
16
|
+
*,
|
|
17
|
+
business_connection_id: str | None = None,
|
|
18
|
+
message_thread_id: int | None = None,
|
|
19
|
+
direct_messages_topic_id: int | None = None,
|
|
20
|
+
emoji: str | None = None,
|
|
21
|
+
disable_notification: bool | None = None,
|
|
22
|
+
protect_content: bool | None = None,
|
|
23
|
+
allow_paid_broadcast: bool | None = None,
|
|
24
|
+
message_effect_id: str | None = None,
|
|
25
|
+
suggested_post_parameters: SuggestedPostParameters | None = None,
|
|
26
|
+
reply_parameters: ReplyParameters | None = None,
|
|
27
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
28
|
+
) -> Message:
|
|
29
|
+
"""Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
business_connection_id: Unique identifier of the business connection on behalf of which the message will be sent
|
|
33
|
+
chat_id: Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username
|
|
34
|
+
message_thread_id: Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
|
|
35
|
+
direct_messages_topic_id: Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
|
|
36
|
+
emoji: Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”.
|
|
37
|
+
disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
|
38
|
+
protect_content: Protects the contents of the sent message from forwarding
|
|
39
|
+
allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance.
|
|
40
|
+
message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
|
|
41
|
+
suggested_post_parameters: A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
|
|
42
|
+
reply_parameters: Description of the message to reply to
|
|
43
|
+
reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
|
|
44
|
+
|
|
45
|
+
https://core.telegram.org/bots/api#senddice
|
|
46
|
+
"""
|
|
47
|
+
return await self._call('sendDice', locals(), 'Message')
|
|
48
|
+
|
|
49
|
+
async def send_message_draft(
|
|
50
|
+
self,
|
|
51
|
+
chat_id: int,
|
|
52
|
+
draft_id: int,
|
|
53
|
+
*,
|
|
54
|
+
message_thread_id: int | None = None,
|
|
55
|
+
text: str | None = None,
|
|
56
|
+
parse_mode: str | None = None,
|
|
57
|
+
entities: list[MessageEntity] | None = None,
|
|
58
|
+
can_stop: bool | None = None,
|
|
59
|
+
keep_on_stop: bool | None = None,
|
|
60
|
+
) -> bool:
|
|
61
|
+
"""Use this method to stream a partial message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you must call sendMessage with the complete message to persist it in the user's chat. Returns True on success.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
chat_id: Unique identifier for the target private chat
|
|
65
|
+
message_thread_id: Unique identifier for the target message thread
|
|
66
|
+
draft_id: Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. Otherwise, the draft is replaced without animation.
|
|
67
|
+
text: Text of the message to be sent, 0-4096 characters after entities parsing. Pass an empty text to show a “Thinking…” placeholder.
|
|
68
|
+
parse_mode: Mode for parsing entities in the message text. See formatting options for more details.
|
|
69
|
+
entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
|
|
70
|
+
can_stop: Pass True to show the user a button to stop further drafts. The bot will receive an Update “stopped_message_generation” if the user presses the button.
|
|
71
|
+
keep_on_stop: Pass True to keep the draft in the chat when the button is pressed. The draft will still disappear after a short time or if the bot sends a message. To fully preserve the partial draft, the bot should send it as a new message.
|
|
72
|
+
|
|
73
|
+
https://core.telegram.org/bots/api#sendmessagedraft
|
|
74
|
+
"""
|
|
75
|
+
return await self._call('sendMessageDraft', locals(), 'bool')
|
|
76
|
+
|
|
77
|
+
async def send_chat_action(
|
|
78
|
+
self,
|
|
79
|
+
chat_id: int | str,
|
|
80
|
+
action: str,
|
|
81
|
+
*,
|
|
82
|
+
business_connection_id: str | None = None,
|
|
83
|
+
message_thread_id: int | None = None,
|
|
84
|
+
) -> bool:
|
|
85
|
+
"""Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
|
|
86
|
+
|
|
87
|
+
Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.
|
|
88
|
+
|
|
89
|
+
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
business_connection_id: Unique identifier of the business connection on behalf of which the action will be sent
|
|
93
|
+
chat_id: Unique identifier for the target chat or username of the target bot or supergroup in the format @username. Channel chats and channel direct messages chats aren't supported.
|
|
94
|
+
message_thread_id: Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only
|
|
95
|
+
action: Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
|
|
96
|
+
|
|
97
|
+
https://core.telegram.org/bots/api#sendchataction
|
|
98
|
+
"""
|
|
99
|
+
return await self._call('sendChatAction', locals(), 'bool')
|
|
100
|
+
|
|
101
|
+
async def set_message_reaction(
|
|
102
|
+
self,
|
|
103
|
+
chat_id: int | str,
|
|
104
|
+
message_id: int,
|
|
105
|
+
*,
|
|
106
|
+
reaction: list[ReactionType] | None = None,
|
|
107
|
+
is_big: bool | None = None,
|
|
108
|
+
) -> bool:
|
|
109
|
+
"""Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
chat_id: Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username
|
|
113
|
+
message_id: Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
|
|
114
|
+
reaction: A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
|
|
115
|
+
is_big: Pass True to set the reaction with a big animation
|
|
116
|
+
|
|
117
|
+
https://core.telegram.org/bots/api#setmessagereaction
|
|
118
|
+
"""
|
|
119
|
+
return await self._call('setMessageReaction', locals(), 'bool')
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.caller import AsyncCaller
|
|
4
|
+
from ..types import File, UserProfileAudios, UserProfilePhotos
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AsyncMethods14(AsyncCaller):
|
|
8
|
+
__slots__ = ()
|
|
9
|
+
|
|
10
|
+
async def get_user_profile_photos(
|
|
11
|
+
self,
|
|
12
|
+
user_id: int,
|
|
13
|
+
*,
|
|
14
|
+
offset: int | None = None,
|
|
15
|
+
limit: int | None = None,
|
|
16
|
+
) -> UserProfilePhotos:
|
|
17
|
+
"""Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
user_id: Unique identifier of the target user
|
|
21
|
+
offset: Sequential number of the first photo to be returned. By default, all photos are returned.
|
|
22
|
+
limit: Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.
|
|
23
|
+
|
|
24
|
+
https://core.telegram.org/bots/api#getuserprofilephotos
|
|
25
|
+
"""
|
|
26
|
+
return await self._call('getUserProfilePhotos', locals(), 'UserProfilePhotos')
|
|
27
|
+
|
|
28
|
+
async def get_user_profile_audios(
|
|
29
|
+
self,
|
|
30
|
+
user_id: int,
|
|
31
|
+
*,
|
|
32
|
+
offset: int | None = None,
|
|
33
|
+
limit: int | None = None,
|
|
34
|
+
) -> UserProfileAudios:
|
|
35
|
+
"""Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
user_id: Unique identifier of the target user
|
|
39
|
+
offset: Sequential number of the first audio to be returned. By default, all audios are returned.
|
|
40
|
+
limit: Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
|
|
41
|
+
|
|
42
|
+
https://core.telegram.org/bots/api#getuserprofileaudios
|
|
43
|
+
"""
|
|
44
|
+
return await self._call('getUserProfileAudios', locals(), 'UserProfileAudios')
|
|
45
|
+
|
|
46
|
+
async def set_user_emoji_status(
|
|
47
|
+
self,
|
|
48
|
+
user_id: int,
|
|
49
|
+
*,
|
|
50
|
+
emoji_status_custom_emoji_id: str | None = None,
|
|
51
|
+
emoji_status_expiration_date: int | None = None,
|
|
52
|
+
) -> bool:
|
|
53
|
+
"""Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
user_id: Unique identifier of the target user
|
|
57
|
+
emoji_status_custom_emoji_id: Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
|
|
58
|
+
emoji_status_expiration_date: Expiration date of the emoji status, if any
|
|
59
|
+
|
|
60
|
+
https://core.telegram.org/bots/api#setuseremojistatus
|
|
61
|
+
"""
|
|
62
|
+
return await self._call('setUserEmojiStatus', locals(), 'bool')
|
|
63
|
+
|
|
64
|
+
async def get_file(
|
|
65
|
+
self,
|
|
66
|
+
file_id: str,
|
|
67
|
+
) -> File:
|
|
68
|
+
"""Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
file_id: File identifier to get information about
|
|
72
|
+
|
|
73
|
+
https://core.telegram.org/bots/api#getfile
|
|
74
|
+
"""
|
|
75
|
+
return await self._call('getFile', locals(), 'File')
|
|
76
|
+
|
|
77
|
+
async def ban_chat_member(
|
|
78
|
+
self,
|
|
79
|
+
chat_id: int | str,
|
|
80
|
+
user_id: int,
|
|
81
|
+
*,
|
|
82
|
+
until_date: int | None = None,
|
|
83
|
+
revoke_messages: bool | None = None,
|
|
84
|
+
) -> bool:
|
|
85
|
+
"""Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
chat_id: Unique identifier for the target group or username of the target supergroup or channel in the format @username
|
|
89
|
+
user_id: Unique identifier of the target user
|
|
90
|
+
until_date: Date when the user will be unbanned; Unix time. If the user is banned for more than 366 days or less than 30 seconds from the current time, they are considered to be banned forever. Applied for supergroups and channels only.
|
|
91
|
+
revoke_messages: Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.
|
|
92
|
+
|
|
93
|
+
https://core.telegram.org/bots/api#banchatmember
|
|
94
|
+
"""
|
|
95
|
+
return await self._call('banChatMember', locals(), 'bool')
|
|
96
|
+
|
|
97
|
+
async def unban_chat_member(
|
|
98
|
+
self,
|
|
99
|
+
chat_id: int | str,
|
|
100
|
+
user_id: int,
|
|
101
|
+
*,
|
|
102
|
+
only_if_banned: bool | None = None,
|
|
103
|
+
) -> bool:
|
|
104
|
+
"""Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
chat_id: Unique identifier for the target group or username of the target supergroup or channel in the format @username
|
|
108
|
+
user_id: Unique identifier of the target user
|
|
109
|
+
only_if_banned: Do nothing if the user is not banned
|
|
110
|
+
|
|
111
|
+
https://core.telegram.org/bots/api#unbanchatmember
|
|
112
|
+
"""
|
|
113
|
+
return await self._call('unbanChatMember', locals(), 'bool')
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.caller import AsyncCaller
|
|
4
|
+
from ..types import ChatPermissions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AsyncMethods15(AsyncCaller):
|
|
8
|
+
__slots__ = ()
|
|
9
|
+
|
|
10
|
+
async def restrict_chat_member(
|
|
11
|
+
self,
|
|
12
|
+
chat_id: int | str,
|
|
13
|
+
user_id: int,
|
|
14
|
+
permissions: ChatPermissions,
|
|
15
|
+
*,
|
|
16
|
+
use_independent_chat_permissions: bool | None = None,
|
|
17
|
+
until_date: int | None = None,
|
|
18
|
+
) -> bool:
|
|
19
|
+
"""Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
|
|
23
|
+
user_id: Unique identifier of the target user
|
|
24
|
+
permissions: A JSON-serialized object for new user permissions
|
|
25
|
+
use_independent_chat_permissions: Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
|
|
26
|
+
until_date: Date when restrictions will be lifted for the user; Unix time. If the user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever.
|
|
27
|
+
|
|
28
|
+
https://core.telegram.org/bots/api#restrictchatmember
|
|
29
|
+
"""
|
|
30
|
+
return await self._call('restrictChatMember', locals(), 'bool')
|
|
31
|
+
|
|
32
|
+
async def promote_chat_member(
|
|
33
|
+
self,
|
|
34
|
+
chat_id: int | str,
|
|
35
|
+
user_id: int,
|
|
36
|
+
*,
|
|
37
|
+
is_anonymous: bool | None = None,
|
|
38
|
+
can_manage_chat: bool | None = None,
|
|
39
|
+
can_delete_messages: bool | None = None,
|
|
40
|
+
can_manage_video_chats: bool | None = None,
|
|
41
|
+
can_restrict_members: bool | None = None,
|
|
42
|
+
can_promote_members: bool | None = None,
|
|
43
|
+
can_change_info: bool | None = None,
|
|
44
|
+
can_invite_users: bool | None = None,
|
|
45
|
+
can_post_stories: bool | None = None,
|
|
46
|
+
can_edit_stories: bool | None = None,
|
|
47
|
+
can_delete_stories: bool | None = None,
|
|
48
|
+
can_post_messages: bool | None = None,
|
|
49
|
+
can_edit_messages: bool | None = None,
|
|
50
|
+
can_pin_messages: bool | None = None,
|
|
51
|
+
can_manage_topics: bool | None = None,
|
|
52
|
+
can_manage_direct_messages: bool | None = None,
|
|
53
|
+
can_manage_tags: bool | None = None,
|
|
54
|
+
can_send_welcome_messages: bool | None = None,
|
|
55
|
+
) -> bool:
|
|
56
|
+
"""Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
60
|
+
user_id: Unique identifier of the target user
|
|
61
|
+
is_anonymous: Pass True if the administrator's presence in the chat is hidden
|
|
62
|
+
can_manage_chat: Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
|
|
63
|
+
can_delete_messages: Pass True if the administrator can delete messages of other users
|
|
64
|
+
can_manage_video_chats: Pass True if the administrator can manage video chats
|
|
65
|
+
can_restrict_members: Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to True for promotions of channel administrators.
|
|
66
|
+
can_promote_members: Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
|
|
67
|
+
can_change_info: Pass True if the administrator can change the chat title, photo and other settings
|
|
68
|
+
can_invite_users: Pass True if the administrator can invite new users to the chat
|
|
69
|
+
can_post_stories: Pass True if the administrator can post stories to the chat
|
|
70
|
+
can_edit_stories: Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
|
|
71
|
+
can_delete_stories: Pass True if the administrator can delete stories posted by other users
|
|
72
|
+
can_post_messages: Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only
|
|
73
|
+
can_edit_messages: Pass True if the administrator can edit messages of other users and can pin messages; for channels only
|
|
74
|
+
can_pin_messages: Pass True if the administrator can pin messages; for supergroups only
|
|
75
|
+
can_manage_topics: Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
|
|
76
|
+
can_manage_direct_messages: Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only
|
|
77
|
+
can_manage_tags: Pass True if the administrator can edit the tags of regular members; for groups and supergroups only
|
|
78
|
+
can_send_welcome_messages: Pass True if the administrator can manage chat welcome messages or directly send them in the case of bots
|
|
79
|
+
|
|
80
|
+
https://core.telegram.org/bots/api#promotechatmember
|
|
81
|
+
"""
|
|
82
|
+
return await self._call('promoteChatMember', locals(), 'bool')
|
|
83
|
+
|
|
84
|
+
async def set_chat_administrator_custom_title(
|
|
85
|
+
self,
|
|
86
|
+
chat_id: int | str,
|
|
87
|
+
user_id: int,
|
|
88
|
+
custom_title: str,
|
|
89
|
+
) -> bool:
|
|
90
|
+
"""Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
|
|
94
|
+
user_id: Unique identifier of the target user
|
|
95
|
+
custom_title: New custom title for the administrator; 0-16 characters, emoji are not allowed
|
|
96
|
+
|
|
97
|
+
https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
98
|
+
"""
|
|
99
|
+
return await self._call('setChatAdministratorCustomTitle', locals(), 'bool')
|
|
100
|
+
|
|
101
|
+
async def set_chat_member_tag(
|
|
102
|
+
self,
|
|
103
|
+
chat_id: int | str,
|
|
104
|
+
user_id: int,
|
|
105
|
+
*,
|
|
106
|
+
tag: str | None = None,
|
|
107
|
+
) -> bool:
|
|
108
|
+
"""Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
|
|
112
|
+
user_id: Unique identifier of the target user
|
|
113
|
+
tag: New tag for the member; 0-16 characters, emoji are not allowed
|
|
114
|
+
|
|
115
|
+
https://core.telegram.org/bots/api#setchatmembertag
|
|
116
|
+
"""
|
|
117
|
+
return await self._call('setChatMemberTag', locals(), 'bool')
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from ..core.caller import AsyncCaller
|
|
4
|
+
from ..types import ChatInviteLink, ChatPermissions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AsyncMethods16(AsyncCaller):
|
|
8
|
+
__slots__ = ()
|
|
9
|
+
|
|
10
|
+
async def ban_chat_sender_chat(
|
|
11
|
+
self,
|
|
12
|
+
chat_id: int | str,
|
|
13
|
+
sender_chat_id: int,
|
|
14
|
+
) -> bool:
|
|
15
|
+
"""Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
19
|
+
sender_chat_id: Unique identifier of the target sender chat
|
|
20
|
+
|
|
21
|
+
https://core.telegram.org/bots/api#banchatsenderchat
|
|
22
|
+
"""
|
|
23
|
+
return await self._call('banChatSenderChat', locals(), 'bool')
|
|
24
|
+
|
|
25
|
+
async def unban_chat_sender_chat(
|
|
26
|
+
self,
|
|
27
|
+
chat_id: int | str,
|
|
28
|
+
sender_chat_id: int,
|
|
29
|
+
) -> bool:
|
|
30
|
+
"""Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
34
|
+
sender_chat_id: Unique identifier of the target sender chat
|
|
35
|
+
|
|
36
|
+
https://core.telegram.org/bots/api#unbanchatsenderchat
|
|
37
|
+
"""
|
|
38
|
+
return await self._call('unbanChatSenderChat', locals(), 'bool')
|
|
39
|
+
|
|
40
|
+
async def set_chat_permissions(
|
|
41
|
+
self,
|
|
42
|
+
chat_id: int | str,
|
|
43
|
+
permissions: ChatPermissions,
|
|
44
|
+
*,
|
|
45
|
+
use_independent_chat_permissions: bool | None = None,
|
|
46
|
+
) -> bool:
|
|
47
|
+
"""Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator right. Returns True on success.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
|
|
51
|
+
permissions: A JSON-serialized object for new default chat permissions
|
|
52
|
+
use_independent_chat_permissions: Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
|
|
53
|
+
|
|
54
|
+
https://core.telegram.org/bots/api#setchatpermissions
|
|
55
|
+
"""
|
|
56
|
+
return await self._call('setChatPermissions', locals(), 'bool')
|
|
57
|
+
|
|
58
|
+
async def export_chat_invite_link(
|
|
59
|
+
self,
|
|
60
|
+
chat_id: int | str,
|
|
61
|
+
) -> str:
|
|
62
|
+
"""Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
66
|
+
|
|
67
|
+
https://core.telegram.org/bots/api#exportchatinvitelink
|
|
68
|
+
"""
|
|
69
|
+
return await self._call('exportChatInviteLink', locals(), 'str')
|
|
70
|
+
|
|
71
|
+
async def create_chat_invite_link(
|
|
72
|
+
self,
|
|
73
|
+
chat_id: int | str,
|
|
74
|
+
*,
|
|
75
|
+
name: str | None = None,
|
|
76
|
+
expire_date: int | None = None,
|
|
77
|
+
member_limit: int | None = None,
|
|
78
|
+
creates_join_request: bool | None = None,
|
|
79
|
+
) -> ChatInviteLink:
|
|
80
|
+
"""Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
84
|
+
name: Invite link name; 0-32 characters
|
|
85
|
+
expire_date: Point in time (Unix timestamp) when the link will expire
|
|
86
|
+
member_limit: The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
|
|
87
|
+
creates_join_request: True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified.
|
|
88
|
+
|
|
89
|
+
https://core.telegram.org/bots/api#createchatinvitelink
|
|
90
|
+
"""
|
|
91
|
+
return await self._call('createChatInviteLink', locals(), 'ChatInviteLink')
|
|
92
|
+
|
|
93
|
+
async def edit_chat_invite_link(
|
|
94
|
+
self,
|
|
95
|
+
chat_id: int | str,
|
|
96
|
+
invite_link: str,
|
|
97
|
+
*,
|
|
98
|
+
name: str | None = None,
|
|
99
|
+
expire_date: int | None = None,
|
|
100
|
+
member_limit: int | None = None,
|
|
101
|
+
creates_join_request: bool | None = None,
|
|
102
|
+
) -> ChatInviteLink:
|
|
103
|
+
"""Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
chat_id: Unique identifier for the target chat or username of the target channel in the format @username
|
|
107
|
+
invite_link: The invite link to edit
|
|
108
|
+
name: Invite link name; 0-32 characters
|
|
109
|
+
expire_date: Point in time (Unix timestamp) when the link will expire
|
|
110
|
+
member_limit: The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
|
|
111
|
+
creates_join_request: True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified.
|
|
112
|
+
|
|
113
|
+
https://core.telegram.org/bots/api#editchatinvitelink
|
|
114
|
+
"""
|
|
115
|
+
return await self._call('editChatInviteLink', locals(), 'ChatInviteLink')
|