maxbot-api-client-python 1.1.2__py3-none-any.whl → 2.0.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.
- maxbot_api_client_python/__init__.py +2 -1
- maxbot_api_client_python/api.py +2 -1
- maxbot_api_client_python/client.py +80 -82
- maxbot_api_client_python/exceptions.py +1 -1
- maxbot_api_client_python/tools/bots.py +19 -15
- maxbot_api_client_python/tools/chats.py +168 -134
- maxbot_api_client_python/tools/helpers.py +87 -62
- maxbot_api_client_python/tools/messages.py +83 -67
- maxbot_api_client_python/tools/subscriptions.py +44 -36
- maxbot_api_client_python/tools/uploads.py +41 -15
- maxbot_api_client_python/types/constants.py +1 -1
- maxbot_api_client_python/types/models.py +82 -65
- maxbot_api_client_python/utils.py +3 -1
- {maxbot_api_client_python-1.1.2.dist-info → maxbot_api_client_python-2.0.0.dist-info}/METADATA +35 -46
- maxbot_api_client_python-2.0.0.dist-info/RECORD +20 -0
- maxbot_api_client_python-1.1.2.dist-info/RECORD +0 -20
- {maxbot_api_client_python-1.1.2.dist-info → maxbot_api_client_python-2.0.0.dist-info}/WHEEL +0 -0
- {maxbot_api_client_python-1.1.2.dist-info → maxbot_api_client_python-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {maxbot_api_client_python-1.1.2.dist-info → maxbot_api_client_python-2.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,165 +1,178 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from maxbot_api_client_python.client import Client
|
|
2
4
|
from maxbot_api_client_python.types.constants import Paths
|
|
3
|
-
from maxbot_api_client_python.types import
|
|
5
|
+
from maxbot_api_client_python.types.models import AddMembersReq, AddMembersResp, ChatInfo, ChatMember, DeleteAdminReq, DeleteChatReq, DeleteMemberReq, EditChatReq, GetChatAdminsReq, GetChatAdminsResp, GetChatMembersReq, GetChatMembersResp, GetChatMembershipReq, GetChatReq, GetChatsReq, GetChatsResp, GetMessagesReq, GetPinnedMessageReq, LeaveChatReq, Message, PinMessageReq, SendActionReq, SetChatAdminsReq, SimpleQueryResult, UnpinMessageReq
|
|
4
6
|
|
|
5
7
|
class Chats:
|
|
6
8
|
def __init__(self, client: Client):
|
|
7
9
|
self.client = client
|
|
8
10
|
|
|
9
|
-
def
|
|
11
|
+
def get_chats(self, **kwargs: Any) -> GetChatsResp:
|
|
10
12
|
"""
|
|
11
13
|
Returns information about chats that the bot participated in: a result list and a marker pointing to the next page.
|
|
12
14
|
|
|
13
15
|
Example:
|
|
14
|
-
response =
|
|
16
|
+
response = bot.chats.get_chats(
|
|
15
17
|
count=20
|
|
16
18
|
)
|
|
17
19
|
"""
|
|
18
|
-
req =
|
|
19
|
-
|
|
20
|
+
req = GetChatsReq(**kwargs)
|
|
21
|
+
query, payload = self.client.split_request(req)
|
|
22
|
+
return self.client.decode("GET", Paths.CHATS, GetChatsResp, query=query, payload=payload)
|
|
20
23
|
|
|
21
|
-
def
|
|
24
|
+
def get_chat(self, **kwargs: Any) -> ChatInfo:
|
|
22
25
|
"""
|
|
23
26
|
Returns info about a specific chat.
|
|
24
27
|
|
|
25
28
|
Example:
|
|
26
|
-
response =
|
|
29
|
+
response = bot.chats.get_chat(
|
|
27
30
|
chat_id=123456789
|
|
28
31
|
)
|
|
29
32
|
"""
|
|
30
|
-
req =
|
|
33
|
+
req = GetChatReq(**kwargs)
|
|
31
34
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
32
|
-
|
|
35
|
+
query, payload = self.client.split_request(req)
|
|
36
|
+
return self.client.decode("GET", path, ChatInfo, query=query, payload=payload)
|
|
33
37
|
|
|
34
|
-
def
|
|
38
|
+
def edit_chat(self, **kwargs: Any) -> ChatInfo:
|
|
35
39
|
"""
|
|
36
40
|
Modifies the properties of a chat, such as its title, icon, or notification settings.
|
|
37
41
|
|
|
38
42
|
Example:
|
|
39
|
-
response =
|
|
43
|
+
response = bot.chats.edit_chat(
|
|
40
44
|
chat_id=123456789,
|
|
41
45
|
title="Updated Chat Title",
|
|
42
46
|
notify=True
|
|
43
47
|
)
|
|
44
48
|
"""
|
|
45
|
-
req =
|
|
49
|
+
req = EditChatReq(**kwargs)
|
|
46
50
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
47
|
-
|
|
51
|
+
query, payload = self.client.split_request(req)
|
|
52
|
+
return self.client.decode("PATCH", path, ChatInfo, query=query, payload=payload)
|
|
48
53
|
|
|
49
|
-
def
|
|
54
|
+
def delete_chat(self, **kwargs: Any) -> SimpleQueryResult:
|
|
50
55
|
"""
|
|
51
56
|
Permanently deletes a chat for the bot.
|
|
52
57
|
|
|
53
58
|
Example:
|
|
54
|
-
response =
|
|
59
|
+
response = bot.chats.delete_chat(
|
|
55
60
|
chat_id=123456789
|
|
56
61
|
)
|
|
57
62
|
"""
|
|
58
|
-
req =
|
|
63
|
+
req = DeleteChatReq(**kwargs)
|
|
59
64
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
60
|
-
|
|
65
|
+
query, payload = self.client.split_request(req)
|
|
66
|
+
return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
61
67
|
|
|
62
|
-
def
|
|
68
|
+
def send_action(self, **kwargs: Any) -> SimpleQueryResult:
|
|
63
69
|
"""
|
|
64
70
|
Broadcasts a temporary status action (e.g., "typing...", "recording video...") to the chat participants.
|
|
65
71
|
|
|
66
72
|
Example:
|
|
67
|
-
response =
|
|
73
|
+
response = bot.chats.send_action(
|
|
68
74
|
chat_id=123456789,
|
|
69
75
|
action="mark_seen"
|
|
70
76
|
)
|
|
71
77
|
"""
|
|
72
|
-
req =
|
|
78
|
+
req = SendActionReq(**kwargs)
|
|
73
79
|
path = Paths.CHATS_ACTIONS.format(req.chat_id)
|
|
74
|
-
|
|
80
|
+
query, payload = self.client.split_request(req)
|
|
81
|
+
return self.client.decode("POST", path, SimpleQueryResult, query=query, payload=payload)
|
|
75
82
|
|
|
76
|
-
def
|
|
83
|
+
def get_pinned_message(self, **kwargs: Any) -> Message:
|
|
77
84
|
"""
|
|
78
85
|
Retrieves the currently pinned message in the specified chat.
|
|
79
86
|
|
|
80
87
|
Example:
|
|
81
|
-
response =
|
|
88
|
+
response = bot.chats.get_pinned_message(
|
|
82
89
|
chat_id=123456789
|
|
83
90
|
)
|
|
84
91
|
"""
|
|
85
|
-
req =
|
|
92
|
+
req = GetPinnedMessageReq(**kwargs)
|
|
86
93
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
87
|
-
|
|
94
|
+
query, payload = self.client.split_request(req)
|
|
95
|
+
return self.client.decode("GET", path, Message, query=query, payload=payload)
|
|
88
96
|
|
|
89
|
-
def
|
|
97
|
+
def pin_message(self, **kwargs: Any) -> SimpleQueryResult:
|
|
90
98
|
"""
|
|
91
99
|
Pins a specific message in the chat.
|
|
92
100
|
You can optionally specify whether to notify chat members about the new pinned message.
|
|
93
101
|
|
|
94
102
|
Example:
|
|
95
|
-
response =
|
|
103
|
+
response = bot.chats.pin_message(
|
|
96
104
|
chat_id=123456789,
|
|
97
105
|
message_id="mid:987654321...",
|
|
98
106
|
notify=True
|
|
99
107
|
)
|
|
100
108
|
"""
|
|
101
|
-
req =
|
|
109
|
+
req = PinMessageReq(**kwargs)
|
|
102
110
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
103
|
-
|
|
111
|
+
query, payload = self.client.split_request(req)
|
|
112
|
+
return self.client.decode("PUT", path, SimpleQueryResult, query=query, payload=payload)
|
|
104
113
|
|
|
105
|
-
def
|
|
114
|
+
def unpin_message(self, **kwargs: Any) -> SimpleQueryResult:
|
|
106
115
|
"""
|
|
107
116
|
Removes the pinned message from the specified chat.
|
|
108
117
|
|
|
109
118
|
Example:
|
|
110
|
-
response =
|
|
119
|
+
response = bot.chats.unpin_message(
|
|
111
120
|
chat_id=123456789
|
|
112
121
|
)
|
|
113
122
|
"""
|
|
114
|
-
req =
|
|
123
|
+
req = UnpinMessageReq(**kwargs)
|
|
115
124
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
116
|
-
|
|
125
|
+
query, payload = self.client.split_request(req)
|
|
126
|
+
return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
117
127
|
|
|
118
|
-
def
|
|
128
|
+
def get_chat_membership(self, **kwargs: Any) -> ChatMember:
|
|
119
129
|
"""
|
|
120
130
|
Returns chat membership info for the current bot.
|
|
121
131
|
|
|
122
132
|
Example:
|
|
123
|
-
response =
|
|
133
|
+
response = bot.chats.get_chat_membership(
|
|
124
134
|
chat_id=123456789
|
|
125
135
|
)
|
|
126
136
|
"""
|
|
127
|
-
req =
|
|
137
|
+
req = GetChatMembershipReq(**kwargs)
|
|
128
138
|
path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
|
|
129
|
-
|
|
139
|
+
query, payload = self.client.split_request(req)
|
|
140
|
+
return self.client.decode("GET", path, ChatMember, query=query, payload=payload)
|
|
130
141
|
|
|
131
|
-
def
|
|
142
|
+
def leave_chat(self, **kwargs: Any) -> SimpleQueryResult:
|
|
132
143
|
"""
|
|
133
144
|
Removes the bot from chat members.
|
|
134
145
|
|
|
135
146
|
Example:
|
|
136
|
-
response =
|
|
147
|
+
response = bot.chats.leave_chat(
|
|
137
148
|
chat_id=123456789
|
|
138
149
|
)
|
|
139
150
|
"""
|
|
140
|
-
req =
|
|
151
|
+
req = LeaveChatReq(**kwargs)
|
|
141
152
|
path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
|
|
142
|
-
|
|
153
|
+
query, payload = self.client.split_request(req)
|
|
154
|
+
return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
143
155
|
|
|
144
|
-
def
|
|
156
|
+
def get_chat_admins(self, **kwargs: Any) -> GetChatAdminsResp:
|
|
145
157
|
"""
|
|
146
158
|
Retrieves a list of administrators for the specified group chat.
|
|
147
159
|
|
|
148
160
|
Example:
|
|
149
|
-
response =
|
|
161
|
+
response = bot.chats.get_chat_admins(
|
|
150
162
|
chat_id=123456789
|
|
151
163
|
)
|
|
152
164
|
"""
|
|
153
|
-
req =
|
|
165
|
+
req = GetChatAdminsReq(**kwargs)
|
|
154
166
|
path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
|
|
155
|
-
|
|
167
|
+
query, payload = self.client.split_request(req)
|
|
168
|
+
return self.client.decode("GET", path, GetChatAdminsResp, query=query, payload=payload)
|
|
156
169
|
|
|
157
|
-
def
|
|
170
|
+
def set_chat_admins(self, **kwargs: Any) -> SimpleQueryResult:
|
|
158
171
|
"""
|
|
159
172
|
Assigns administrator rights to specific users in a group chat.
|
|
160
173
|
|
|
161
174
|
Example:
|
|
162
|
-
response =
|
|
175
|
+
response = bot.chats.set_chat_admins(
|
|
163
176
|
chat_id=123456789,
|
|
164
177
|
admins=[
|
|
165
178
|
ChatAdmin(user_id=98765, role="admin"),
|
|
@@ -167,279 +180,300 @@ class Chats:
|
|
|
167
180
|
]
|
|
168
181
|
)
|
|
169
182
|
"""
|
|
170
|
-
req =
|
|
183
|
+
req = SetChatAdminsReq(**kwargs)
|
|
171
184
|
path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
|
|
172
|
-
|
|
185
|
+
query, payload = self.client.split_request(req)
|
|
186
|
+
return self.client.decode("POST", path, SimpleQueryResult, query=query, payload=payload)
|
|
173
187
|
|
|
174
|
-
def
|
|
188
|
+
def delete_admin(self, **kwargs: Any) -> SimpleQueryResult:
|
|
175
189
|
"""
|
|
176
190
|
Revokes administrator rights from a specific user in a group chat.
|
|
177
191
|
|
|
178
192
|
Example:
|
|
179
|
-
response =
|
|
193
|
+
response = bot.chats.delete_admin(
|
|
180
194
|
chat_id=123456789,
|
|
181
195
|
user_id=98765
|
|
182
196
|
)
|
|
183
197
|
"""
|
|
184
|
-
req =
|
|
198
|
+
req = DeleteAdminReq(**kwargs)
|
|
185
199
|
path = Paths.CHATS_MEMBERS_ADMIN_ID.format(req.chat_id, req.user_id)
|
|
186
|
-
|
|
200
|
+
query, payload = self.client.split_request(req)
|
|
201
|
+
return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
187
202
|
|
|
188
|
-
def
|
|
203
|
+
def get_chat_members(self, **kwargs: Any) -> GetChatMembersResp:
|
|
189
204
|
"""
|
|
190
205
|
Returns users participated in the chat.
|
|
191
206
|
|
|
192
207
|
Example:
|
|
193
|
-
response =
|
|
208
|
+
response = bot.chats.get_chat_members(
|
|
194
209
|
chat_id=123456789,
|
|
195
210
|
count=20
|
|
196
211
|
)
|
|
197
212
|
"""
|
|
198
|
-
req =
|
|
213
|
+
req = GetChatMembersReq(**kwargs)
|
|
199
214
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
200
|
-
|
|
215
|
+
query, payload = self.client.split_request(req)
|
|
216
|
+
return self.client.decode("GET", path, GetChatMembersResp, query=query, payload=payload)
|
|
201
217
|
|
|
202
|
-
def
|
|
218
|
+
def add_members(self, **kwargs: Any) -> AddMembersResp:
|
|
203
219
|
"""
|
|
204
220
|
Adds one or more users to a group chat.
|
|
205
221
|
|
|
206
222
|
Example:
|
|
207
|
-
response =
|
|
223
|
+
response = bot.chats.add_members(
|
|
208
224
|
chat_id=123456789,
|
|
209
225
|
user_ids=[11111, 22222]
|
|
210
226
|
)
|
|
211
227
|
"""
|
|
212
|
-
req =
|
|
228
|
+
req = AddMembersReq(**kwargs)
|
|
213
229
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
214
|
-
|
|
230
|
+
query, payload = self.client.split_request(req)
|
|
231
|
+
return self.client.decode("POST", path, AddMembersResp, query=query, payload=payload)
|
|
215
232
|
|
|
216
|
-
def
|
|
233
|
+
def delete_member(self, **kwargs: Any) -> SimpleQueryResult:
|
|
217
234
|
"""
|
|
218
235
|
Removes a specific user from a group chat.
|
|
219
236
|
You can optionally block the user from rejoining.
|
|
220
237
|
|
|
221
238
|
Example:
|
|
222
|
-
response =
|
|
239
|
+
response = bot.chats.delete_member(
|
|
223
240
|
chat_id=123456789,
|
|
224
241
|
user_id=98765,
|
|
225
242
|
block=True
|
|
226
243
|
)
|
|
227
244
|
"""
|
|
228
|
-
req =
|
|
245
|
+
req = DeleteMemberReq(**kwargs)
|
|
229
246
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
230
|
-
|
|
247
|
+
query, payload = self.client.split_request(req)
|
|
248
|
+
return self.client.decode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
231
249
|
|
|
232
|
-
async def
|
|
250
|
+
async def get_chats_async(self, **kwargs: Any) -> GetChatsResp:
|
|
233
251
|
"""
|
|
234
|
-
Async version of
|
|
252
|
+
Async version of get_chats.
|
|
235
253
|
|
|
236
254
|
Example:
|
|
237
|
-
response = await
|
|
255
|
+
response = await bot.chats.get_chats_async(
|
|
238
256
|
count=20
|
|
239
257
|
)
|
|
240
258
|
"""
|
|
241
|
-
req =
|
|
242
|
-
|
|
259
|
+
req = GetChatsReq(**kwargs)
|
|
260
|
+
query, payload = self.client.split_request(req)
|
|
261
|
+
return await self.client.adecode("GET", Paths.CHATS, GetChatsResp, query=query, payload=payload)
|
|
243
262
|
|
|
244
|
-
async def
|
|
263
|
+
async def get_chat_async(self, **kwargs: Any) -> ChatInfo:
|
|
245
264
|
"""
|
|
246
|
-
Async version of
|
|
265
|
+
Async version of get_chat.
|
|
247
266
|
|
|
248
267
|
Example:
|
|
249
|
-
response = await
|
|
268
|
+
response = await bot.chats.get_chat_async(
|
|
250
269
|
chat_id=123456789
|
|
251
270
|
)
|
|
252
271
|
"""
|
|
253
|
-
req =
|
|
272
|
+
req = GetChatReq(**kwargs)
|
|
254
273
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
274
|
+
query, payload = self.client.split_request(req)
|
|
275
|
+
return await self.client.adecode("GET", path, ChatInfo, query=query, payload=payload)
|
|
276
|
+
|
|
277
|
+
async def edit_chat_async(self, **kwargs: Any) -> ChatInfo:
|
|
258
278
|
"""
|
|
259
279
|
Async version of EditChat.
|
|
260
280
|
|
|
261
281
|
Example:
|
|
262
|
-
response = await
|
|
282
|
+
response = await bot.chats.edit_chat_async(
|
|
263
283
|
chat_id=123456789,
|
|
264
284
|
title="Updated Chat Title"
|
|
265
285
|
)
|
|
266
286
|
"""
|
|
267
|
-
req =
|
|
287
|
+
req = EditChatReq(**kwargs)
|
|
268
288
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
269
|
-
|
|
289
|
+
query, payload = self.client.split_request(req)
|
|
290
|
+
return await self.client.adecode("PATCH", path, ChatInfo, query=query, payload=payload)
|
|
270
291
|
|
|
271
|
-
async def
|
|
292
|
+
async def delete_chat_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
272
293
|
"""
|
|
273
294
|
Async version of DeleteChat.
|
|
274
295
|
|
|
275
296
|
Example:
|
|
276
|
-
response = await
|
|
297
|
+
response = await bot.chats.delete_chat_async(
|
|
277
298
|
chat_id=123456789
|
|
278
299
|
)
|
|
279
300
|
"""
|
|
280
|
-
req =
|
|
301
|
+
req = DeleteChatReq(**kwargs)
|
|
281
302
|
path = Paths.CHATS_ID.format(req.chat_id)
|
|
282
|
-
|
|
303
|
+
query, payload = self.client.split_request(req)
|
|
304
|
+
return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
283
305
|
|
|
284
|
-
async def
|
|
306
|
+
async def send_action_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
285
307
|
"""
|
|
286
308
|
Async version of SendAction.
|
|
287
309
|
|
|
288
310
|
Example:
|
|
289
|
-
response = await
|
|
311
|
+
response = await bot.chats.send_action_async(
|
|
290
312
|
chat_id=123456789,
|
|
291
313
|
action="typing"
|
|
292
314
|
)
|
|
293
315
|
"""
|
|
294
|
-
req =
|
|
316
|
+
req = SendActionReq(**kwargs)
|
|
295
317
|
path = Paths.CHATS_ACTIONS.format(req.chat_id)
|
|
296
|
-
|
|
318
|
+
query, payload = self.client.split_request(req)
|
|
319
|
+
return await self.client.adecode("POST", path, SimpleQueryResult, query=query, payload=payload)
|
|
297
320
|
|
|
298
|
-
async def
|
|
321
|
+
async def get_pinned_message_async(self, **kwargs: Any) -> Message:
|
|
299
322
|
"""
|
|
300
323
|
Async version of GetPinnedMessage.
|
|
301
324
|
|
|
302
325
|
Example:
|
|
303
|
-
response = await
|
|
326
|
+
response = await bot.chats.get_pinned_message_async(
|
|
304
327
|
chat_id=123456789
|
|
305
328
|
)
|
|
306
329
|
"""
|
|
307
|
-
req =
|
|
330
|
+
req = GetPinnedMessageReq(**kwargs)
|
|
308
331
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
309
|
-
|
|
332
|
+
query, payload = self.client.split_request(req)
|
|
333
|
+
return await self.client.adecode("GET", path, Message, query=query, payload=payload)
|
|
310
334
|
|
|
311
|
-
async def
|
|
335
|
+
async def pin_message_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
312
336
|
"""
|
|
313
337
|
Async version of PinMessage.
|
|
314
338
|
|
|
315
339
|
Example:
|
|
316
|
-
response = await
|
|
340
|
+
response = await bot.chats.pin_message_async(
|
|
317
341
|
chat_id=123456789,
|
|
318
342
|
message_id="mid:987654321..."
|
|
319
343
|
)
|
|
320
344
|
"""
|
|
321
|
-
req =
|
|
345
|
+
req = PinMessageReq(**kwargs)
|
|
322
346
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
323
|
-
|
|
347
|
+
query, payload = self.client.split_request(req)
|
|
348
|
+
return await self.client.adecode("PUT", path, SimpleQueryResult, query=query, payload=payload)
|
|
324
349
|
|
|
325
|
-
async def
|
|
350
|
+
async def unpin_message_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
326
351
|
"""
|
|
327
352
|
Async version of UnpinMessage.
|
|
328
353
|
|
|
329
354
|
Example:
|
|
330
|
-
response = await
|
|
355
|
+
response = await bot.chats.unpin_message_async(
|
|
331
356
|
chat_id=123456789
|
|
332
357
|
)
|
|
333
358
|
"""
|
|
334
|
-
req =
|
|
359
|
+
req = UnpinMessageReq(**kwargs)
|
|
335
360
|
path = Paths.CHATS_PIN.format(req.chat_id)
|
|
336
|
-
|
|
361
|
+
query, payload = self.client.split_request(req)
|
|
362
|
+
return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
337
363
|
|
|
338
|
-
async def
|
|
364
|
+
async def get_chat_membership_async(self, **kwargs: Any) -> ChatMember:
|
|
339
365
|
"""
|
|
340
366
|
Async version of GetChatMembership.
|
|
341
367
|
|
|
342
368
|
Example:
|
|
343
|
-
response = await
|
|
369
|
+
response = await bot.chats.get_chat_membership_async(
|
|
344
370
|
chat_id=123456789
|
|
345
371
|
)
|
|
346
372
|
"""
|
|
347
|
-
req =
|
|
373
|
+
req = GetChatMembershipReq(**kwargs)
|
|
348
374
|
path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
|
|
349
|
-
|
|
375
|
+
query, payload = self.client.split_request(req)
|
|
376
|
+
return await self.client.adecode("GET", path, ChatMember, query=query, payload=payload)
|
|
350
377
|
|
|
351
|
-
async def
|
|
378
|
+
async def leave_chat_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
352
379
|
"""
|
|
353
380
|
Async version of LeaveChat.
|
|
354
381
|
|
|
355
382
|
Example:
|
|
356
|
-
response = await
|
|
383
|
+
response = await bot.chats.leave_chat_async(
|
|
357
384
|
chat_id=123456789
|
|
358
385
|
)
|
|
359
386
|
"""
|
|
360
|
-
req =
|
|
387
|
+
req = LeaveChatReq(**kwargs)
|
|
361
388
|
path = Paths.CHATS_MEMBERS_ME.format(req.chat_id)
|
|
362
|
-
|
|
389
|
+
query, payload = self.client.split_request(req)
|
|
390
|
+
return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
363
391
|
|
|
364
|
-
async def
|
|
392
|
+
async def get_chat_admins_async(self, **kwargs: Any) -> GetChatAdminsResp:
|
|
365
393
|
"""
|
|
366
|
-
Async version of
|
|
394
|
+
Async version of get_chatAdmins.
|
|
367
395
|
|
|
368
396
|
Example:
|
|
369
|
-
response = await
|
|
397
|
+
response = await bot.chats.get_chat_admins_async(
|
|
370
398
|
chat_id=123456789
|
|
371
399
|
)
|
|
372
400
|
"""
|
|
373
|
-
req =
|
|
401
|
+
req = GetChatAdminsReq(**kwargs)
|
|
374
402
|
path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
|
|
375
|
-
|
|
403
|
+
query, payload = self.client.split_request(req)
|
|
404
|
+
return await self.client.adecode("GET", path, GetChatAdminsResp, query=query, payload=payload)
|
|
376
405
|
|
|
377
|
-
async def
|
|
406
|
+
async def set_chat_admins_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
378
407
|
"""
|
|
379
408
|
Async version of SetChatAdmins.
|
|
380
409
|
|
|
381
410
|
Example:
|
|
382
|
-
response = await
|
|
411
|
+
response = await bot.chats.set_chat_admins_async(
|
|
383
412
|
chat_id=123456789,
|
|
384
413
|
admins=[ChatAdmin(user_id=98765, role="admin")]
|
|
385
414
|
)
|
|
386
415
|
"""
|
|
387
|
-
req =
|
|
416
|
+
req = SetChatAdminsReq(**kwargs)
|
|
388
417
|
path = Paths.CHATS_MEMBERS_ADMIN.format(req.chat_id)
|
|
389
|
-
|
|
418
|
+
query, payload = self.client.split_request(req)
|
|
419
|
+
return await self.client.adecode("POST", path, SimpleQueryResult, query=query, payload=payload)
|
|
390
420
|
|
|
391
|
-
async def
|
|
421
|
+
async def delete_admin_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
392
422
|
"""
|
|
393
423
|
Async version of DeleteAdmin.
|
|
394
424
|
|
|
395
425
|
Example:
|
|
396
|
-
response = await
|
|
426
|
+
response = await bot.chats.delete_admin_async(
|
|
397
427
|
chat_id=123456789,
|
|
398
428
|
user_id=98765
|
|
399
429
|
)
|
|
400
430
|
"""
|
|
401
|
-
req =
|
|
431
|
+
req = DeleteAdminReq(**kwargs)
|
|
402
432
|
path = Paths.CHATS_MEMBERS_ADMIN_ID.format(req.chat_id, req.user_id)
|
|
403
|
-
|
|
433
|
+
query, payload = self.client.split_request(req)
|
|
434
|
+
return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|
|
404
435
|
|
|
405
|
-
async def
|
|
436
|
+
async def get_chat_members_async(self, **kwargs: Any) -> GetChatMembersResp:
|
|
406
437
|
"""
|
|
407
438
|
Async version of GetChatMembers.
|
|
408
439
|
|
|
409
440
|
Example:
|
|
410
|
-
response = await
|
|
441
|
+
response = await bot.chats.get_chat_members_async(
|
|
411
442
|
chat_id=123456789,
|
|
412
443
|
count=20
|
|
413
444
|
)
|
|
414
445
|
"""
|
|
415
|
-
req =
|
|
446
|
+
req = GetChatMembersReq(**kwargs)
|
|
416
447
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
417
|
-
|
|
448
|
+
query, payload = self.client.split_request(req)
|
|
449
|
+
return await self.client.adecode("GET", path, GetChatMembersResp, query=query, payload=payload)
|
|
418
450
|
|
|
419
|
-
async def
|
|
451
|
+
async def add_members_async(self, **kwargs: Any) -> AddMembersResp:
|
|
420
452
|
"""
|
|
421
453
|
Async version of AddMembers.
|
|
422
454
|
|
|
423
455
|
Example:
|
|
424
|
-
response = await
|
|
456
|
+
response = await bot.chats.add_members_async(
|
|
425
457
|
chat_id=123456789,
|
|
426
458
|
user_ids=[11111, 22222]
|
|
427
459
|
)
|
|
428
460
|
"""
|
|
429
|
-
req =
|
|
461
|
+
req = AddMembersReq(**kwargs)
|
|
430
462
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
431
|
-
|
|
463
|
+
query, payload = self.client.split_request(req)
|
|
464
|
+
return await self.client.adecode("POST", path, AddMembersResp, query=query, payload=payload)
|
|
432
465
|
|
|
433
|
-
async def
|
|
466
|
+
async def delete_member_async(self, **kwargs: Any) -> SimpleQueryResult:
|
|
434
467
|
"""
|
|
435
468
|
Async version of DeleteMember.
|
|
436
469
|
|
|
437
470
|
Example:
|
|
438
|
-
response = await
|
|
471
|
+
response = await bot.chats.delete_member_async(
|
|
439
472
|
chat_id=123456789,
|
|
440
473
|
user_id=98765
|
|
441
474
|
)
|
|
442
475
|
"""
|
|
443
|
-
req =
|
|
476
|
+
req = DeleteMemberReq(**kwargs)
|
|
444
477
|
path = Paths.CHATS_MEMBERS.format(req.chat_id)
|
|
445
|
-
|
|
478
|
+
query, payload = self.client.split_request(req)
|
|
479
|
+
return await self.client.adecode("DELETE", path, SimpleQueryResult, query=query, payload=payload)
|