Skip to content

Commit 2024b3c

Browse files
committed
Rename kick(ed) occurrences to ban(ned)
1 parent a909dc1 commit 2024b3c

8 files changed

Lines changed: 33 additions & 33 deletions

File tree

compiler/docs/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def get_title_list(s: str) -> list:
187187
Chats
188188
join_chat
189189
leave_chat
190-
kick_chat_member
190+
ban_chat_member
191191
unban_chat_member
192192
restrict_chat_member
193193
promote_chat_member
@@ -501,7 +501,7 @@ def get_title_list(s: str) -> list:
501501
Chat.set_title
502502
Chat.set_description
503503
Chat.set_photo
504-
Chat.kick_member
504+
Chat.ban_member
505505
Chat.unban_member
506506
Chat.restrict_member
507507
Chat.promote_member

pyrogram/methods/chats/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from .add_chat_members import AddChatMembers
2020
from .archive_chats import ArchiveChats
21+
from .ban_chat_member import BanChatMember
2122
from .create_channel import CreateChannel
2223
from .create_group import CreateGroup
2324
from .create_supergroup import CreateSupergroup
@@ -30,13 +31,13 @@
3031
from .get_chat_member import GetChatMember
3132
from .get_chat_members import GetChatMembers
3233
from .get_chat_members_count import GetChatMembersCount
34+
from .get_chat_online_count import GetChatOnlineCount
3335
from .get_dialogs import GetDialogs
3436
from .get_dialogs_count import GetDialogsCount
3537
from .get_nearby_chats import GetNearbyChats
3638
from .iter_chat_members import IterChatMembers
3739
from .iter_dialogs import IterDialogs
3840
from .join_chat import JoinChat
39-
from .kick_chat_member import KickChatMember
4041
from .leave_chat import LeaveChat
4142
from .mark_chat_unread import MarkChatUnread
4243
from .pin_chat_message import PinChatMessage
@@ -53,14 +54,13 @@
5354
from .unpin_all_chat_messages import UnpinAllChatMessages
5455
from .unpin_chat_message import UnpinChatMessage
5556
from .update_chat_username import UpdateChatUsername
56-
from .get_chat_online_count import GetChatOnlineCount
5757

5858

5959
class Chats(
6060
GetChat,
6161
LeaveChat,
6262
JoinChat,
63-
KickChatMember,
63+
BanChatMember,
6464
UnbanChatMember,
6565
RestrictChatMember,
6666
PromoteChatMember,

pyrogram/methods/chats/kick_chat_member.py renamed to pyrogram/methods/chats/ban_chat_member.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
from pyrogram.scaffold import Scaffold
2424

2525

26-
class KickChatMember(Scaffold):
27-
async def kick_chat_member(
26+
class BanChatMember(Scaffold):
27+
async def ban_chat_member(
2828
self,
2929
chat_id: Union[int, str],
3030
user_id: Union[int, str],
3131
until_date: int = 0
3232
) -> Union["types.Message", bool]:
33-
"""Kick a user from a group, a supergroup or a channel.
33+
"""Ban a user from a group, a supergroup or a channel.
3434
In the case of supergroups and channels, the user will not be able to return to the group on their own using
3535
invite links, etc., unless unbanned first. You must be an administrator in the chat for this to work and must
3636
have the appropriate admin rights.
@@ -63,10 +63,10 @@ async def kick_chat_member(
6363
from time import time
6464
6565
# Ban chat member forever
66-
app.kick_chat_member(chat_id, user_id)
66+
app.ban_chat_member(chat_id, user_id)
6767
68-
# Kick chat member and automatically unban after 24h
69-
app.kick_chat_member(chat_id, user_id, int(time.time() + 86400))
68+
# Ban chat member and automatically unban after 24h
69+
app.ban_chat_member(chat_id, user_id, int(time.time() + 86400))
7070
"""
7171
chat_peer = await self.resolve_peer(chat_id)
7272
user_peer = await self.resolve_peer(user_id)

pyrogram/methods/chats/get_chat_members.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
class Filters:
3030
ALL = "all"
31-
KICKED = "kicked"
31+
BANNED = "banned"
3232
RESTRICTED = "restricted"
3333
BOTS = "bots"
3434
RECENT = "recent"
@@ -72,7 +72,7 @@ async def get_chat_members(
7272
Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
7373
and channels. It can be any of the followings:
7474
*"all"* - all kind of members,
75-
*"kicked"* - kicked (banned) members only,
75+
*"banned"* - banned members only,
7676
*"restricted"* - restricted members only,
7777
*"bots"* - bots only,
7878
*"recent"* - recent members only,
@@ -83,7 +83,7 @@ async def get_chat_members(
8383
.. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members
8484
on channels.
8585
86-
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
86+
.. [2] A query string is applicable only for *"all"*, *"banned"* and *"restricted"* filters only.
8787
8888
Returns:
8989
List of :obj:`~pyrogram.types.ChatMember`: On success, a list of chat members is returned.
@@ -121,7 +121,7 @@ async def get_chat_members(
121121

122122
if filter == Filters.ALL:
123123
filter = raw.types.ChannelParticipantsSearch(q=query)
124-
elif filter == Filters.KICKED:
124+
elif filter == Filters.BANNED:
125125
filter = raw.types.ChannelParticipantsKicked(q=query)
126126
elif filter == Filters.RESTRICTED:
127127
filter = raw.types.ChannelParticipantsBanned(q=query)

pyrogram/methods/chats/iter_chat_members.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626

2727
class Filters:
2828
ALL = "all"
29-
KICKED = "kicked"
29+
BANNED = "banned"
3030
RESTRICTED = "restricted"
3131
BOTS = "bots"
3232
RECENT = "recent"
3333
ADMINISTRATORS = "administrators"
3434

3535

3636
QUERIES = [""] + [str(i) for i in range(10)] + list(ascii_lowercase)
37-
QUERYABLE_FILTERS = (Filters.ALL, Filters.KICKED, Filters.RESTRICTED)
37+
QUERYABLE_FILTERS = (Filters.ALL, Filters.BANNED, Filters.RESTRICTED)
3838

3939

4040
class IterChatMembers(Scaffold):
@@ -67,7 +67,7 @@ async def iter_chat_members(
6767
Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
6868
and channels. It can be any of the followings:
6969
*"all"* - all kind of members,
70-
*"kicked"* - kicked (banned) members only,
70+
*"banned"* - banned members only,
7171
*"restricted"* - restricted members only,
7272
*"bots"* - bots only,
7373
*"recent"* - recent members only,
@@ -77,7 +77,7 @@ async def iter_chat_members(
7777
.. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members
7878
on channels.
7979
80-
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
80+
.. [2] A query string is applicable only for *"all"*, *"banned"* and *"restricted"* filters only.
8181
8282
Returns:
8383
``Generator``: A generator yielding :obj:`~pyrogram.types.ChatMember` objects.

pyrogram/methods/chats/unban_chat_member.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def unban_chat_member(
2828
chat_id: Union[int, str],
2929
user_id: Union[int, str]
3030
) -> bool:
31-
"""Unban a previously kicked user in a supergroup or channel.
31+
"""Unban a previously banned user in a supergroup or channel.
3232
The user will **not** return to the group or channel automatically, but will be able to join via link, etc.
3333
You must be an administrator for this to work.
3434

pyrogram/types/user_and_chats/chat.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -479,26 +479,26 @@ async def set_photo(self, photo: str) -> bool:
479479
photo=photo
480480
)
481481

482-
async def kick_member(
482+
async def ban_member(
483483
self,
484484
user_id: Union[int, str],
485485
until_date: int = 0
486486
) -> Union["types.Message", bool]:
487-
"""Bound method *kick_member* of :obj:`~pyrogram.types.Chat`.
487+
"""Bound method *ban_member* of :obj:`~pyrogram.types.Chat`.
488488
489489
Use as a shortcut for:
490490
491491
.. code-block:: python
492492
493-
client.kick_chat_member(
493+
client.ban_chat_member(
494494
chat_id=chat_id,
495495
user_id=user_id
496496
)
497497
498498
Example:
499499
.. code-block:: python
500500
501-
chat.kick_member(123456789)
501+
chat.ban_member(123456789)
502502
503503
Note:
504504
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is
@@ -523,7 +523,7 @@ async def kick_member(
523523
RPCError: In case of a Telegram RPC error.
524524
"""
525525

526-
return await self._client.kick_chat_member(
526+
return await self._client.ban_chat_member(
527527
chat_id=self.id,
528528
user_id=user_id,
529529
until_date=until_date
@@ -840,7 +840,7 @@ async def get_members(
840840
Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
841841
and channels. It can be any of the followings:
842842
*"all"* - all kind of members,
843-
*"kicked"* - kicked (banned) members only,
843+
*"banned"* - banned members only,
844844
*"restricted"* - restricted members only,
845845
*"bots"* - bots only,
846846
*"recent"* - recent members only,
@@ -851,7 +851,7 @@ async def get_members(
851851
.. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members
852852
on channels.
853853
854-
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
854+
.. [2] A query string is applicable only for *"all"*, *"banned"* and *"restricted"* filters only.
855855
856856
Example:
857857
.. code-block:: python
@@ -903,7 +903,7 @@ def iter_members(
903903
Filter used to select the kind of members you want to retrieve. Only applicable for supergroups
904904
and channels. It can be any of the followings:
905905
*"all"* - all kind of members,
906-
*"kicked"* - kicked (banned) members only,
906+
*"banned"* - banned members only,
907907
*"restricted"* - restricted members only,
908908
*"bots"* - bots only,
909909
*"recent"* - recent members only,
@@ -914,7 +914,7 @@ def iter_members(
914914
.. [1] Server limit: on supergroups, you can get up to 10,000 members for a single query and up to 200 members
915915
on channels.
916916
917-
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
917+
.. [2] A query string is applicable only for *"all"*, *"banned"* and *"restricted"* filters only.
918918
919919
Example:
920920
.. code-block:: python

pyrogram/types/user_and_chats/chat_member.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class ChatMember(Object):
3131
3232
status (``str``):
3333
The member's status in the chat.
34-
Can be "creator", "administrator", "member", "restricted", "left" or "kicked".
34+
Can be "creator", "administrator", "member", "restricted", "left" or "banned".
3535
3636
title (``str``, *optional*):
3737
A custom title that will be shown to all members instead of "Owner" or "Admin".
3838
Creator (owner) and administrators only. Can be None in case there's no custom title set.
3939
4040
until_date (``int``, *optional*):
41-
Restricted and kicked only.
41+
Restricted and banned only.
4242
Date when restrictions will be lifted for this user; unix time.
4343
4444
joined_date (``int``, *optional*):
@@ -53,7 +53,7 @@ class ChatMember(Object):
5353
Administrators only. Information about the user who promoted this member as administrator.
5454
5555
restricted_by (:obj:`~pyrogram.types.User`, *optional*):
56-
Restricted and kicked only. Information about the user who restricted or kicked this member.
56+
Restricted and banned only. Information about the user who restricted or banned this member.
5757
5858
is_member (``bool``, *optional*):
5959
Restricted only. True, if the user is a member of the chat at the moment of the request.
@@ -305,7 +305,7 @@ def _parse(client, member, users, chats) -> "ChatMember":
305305

306306
return ChatMember(
307307
user=user,
308-
status="kicked" if member.banned_rights.view_messages else "restricted",
308+
status="banned" if member.banned_rights.view_messages else "restricted",
309309
until_date=denied_permissions.until_date,
310310
joined_date=member.date,
311311
is_member=not member.left,

0 commit comments

Comments
 (0)