|
20 | 20 | from typing import Union |
21 | 21 |
|
22 | 22 | import pyrogram |
23 | | -from pyrogram import raw, utils |
24 | | -from pyrogram import types |
| 23 | +from pyrogram import raw, types, utils |
25 | 24 |
|
26 | 25 |
|
27 | 26 | class BanChatMember: |
28 | 27 | async def ban_chat_member( |
29 | 28 | self: "pyrogram.Client", |
30 | 29 | chat_id: Union[int, str], |
31 | 30 | user_id: Union[int, str], |
32 | | - until_date: datetime = utils.zero_datetime() |
| 31 | + until_date: datetime = utils.zero_datetime(), |
33 | 32 | ) -> Union["types.Message", bool]: |
34 | 33 | """Ban a user from a group, a supergroup or a channel. |
35 | 34 | In the case of supergroups and channels, the user will not be able to return to the group on their own using |
36 | 35 | invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must |
37 | 36 | have the appropriate admin rights. |
38 | 37 |
|
39 | | - .. note:: |
40 | | -
|
41 | | - In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is |
42 | | - off in the target group. Otherwise members may only be removed by the group's creator or by the member |
43 | | - that added them. |
44 | | -
|
45 | 38 | .. include:: /_includes/usable-by/users-bots.rst |
46 | 39 |
|
47 | 40 | Parameters: |
@@ -89,15 +82,14 @@ async def ban_chat_member( |
89 | 82 | send_gifs=True, |
90 | 83 | send_games=True, |
91 | 84 | send_inline=True, |
92 | | - embed_links=True |
93 | | - ) |
| 85 | + embed_links=True, |
| 86 | + ), |
94 | 87 | ) |
95 | 88 | ) |
96 | 89 | else: |
97 | 90 | r = await self.invoke( |
98 | 91 | raw.functions.messages.DeleteChatUser( |
99 | | - chat_id=abs(chat_id), |
100 | | - user_id=user_peer |
| 92 | + chat_id=abs(chat_id), user_id=user_peer |
101 | 93 | ) |
102 | 94 | ) |
103 | 95 |
|
|
0 commit comments