@@ -194,6 +194,37 @@ async def get_guild_member(self, guild_id: str, user_id: str) -> user.Member:
194
194
)
195
195
return await self ._http .request (route )
196
196
197
+ async def get_delete_member (
198
+ self ,
199
+ guild_id : str ,
200
+ user_id : str ,
201
+ add_blacklist : bool = False ,
202
+ delete_history_msg_days : int = 0
203
+ ) -> str :
204
+ """
205
+ 删除频道成员
206
+
207
+ Args:
208
+ guild_id (str): 频道ID
209
+ user_id (str): 用户ID
210
+ add_blacklist (bool): 是否同时添加黑名单
211
+ delete_history_msg_days (int): 用于撤回该成员的消息,可以指定撤回消息的时间范围
212
+
213
+ Returns:
214
+ 成功执行返回`None`。成功执行返回空字符串
215
+ """
216
+ # 注:消息撤回时间范围仅支持固定的天数:3,7,15,30。 特殊的时间范围:-1: 撤回全部消息。默认值为0不撤回任何消息。
217
+ if delete_history_msg_days not in (3 , 7 , 15 , 30 , 0 , - 1 ):
218
+ delete_history_msg_days = 0
219
+ params = {'add_blacklist' : str (add_blacklist ).lower (), 'delete_history_msg_days' : delete_history_msg_days }
220
+ route = Route (
221
+ "DELETE" ,
222
+ "/guilds/{guild_id}/members/{user_id}" ,
223
+ guild_id = guild_id ,
224
+ user_id = user_id ,
225
+ )
226
+ return await self ._http .request (route , params = params )
227
+
197
228
async def get_guild_members (self , guild_id : str , after : str = "0" , limit : int = 1 ) -> List [user .Member ]:
198
229
"""
199
230
获取成员列表。
@@ -1233,7 +1264,7 @@ async def post_thread(self, channel_id: str, title: str, content: str, format: f
1233
1264
"""
1234
1265
route = Route (
1235
1266
"PUT" ,
1236
- "PUT /channels/{channel_id}/threads" ,
1267
+ "/channels/{channel_id}/threads" ,
1237
1268
channel_id = channel_id ,
1238
1269
)
1239
1270
@@ -1252,6 +1283,6 @@ async def delete_thread(self, channel_id: str, thread_id: str) -> str:
1252
1283
成功返回空字符串。
1253
1284
"""
1254
1285
route = Route (
1255
- "DELETE" , "DELETE /channels/{channel_id}/threads/{thread_id}" , channel_id = channel_id , thread_id = thread_id
1286
+ "DELETE" , "/channels/{channel_id}/threads/{thread_id}" , channel_id = channel_id , thread_id = thread_id
1256
1287
)
1257
1288
return await self ._http .request (route )
0 commit comments