Skip to content

Commit 80c7a6e

Browse files
committed
Rename set_custom_title to set_administrator_title and clarify
1 parent a015f99 commit 80c7a6e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

compiler/docs/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def get_title_list(s: str) -> list:
184184
unban_chat_member
185185
restrict_chat_member
186186
promote_chat_member
187+
set_administrator_title
187188
export_chat_invite_link
188189
set_chat_photo
189190
delete_chat_photo

pyrogram/client/methods/chats/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
from .pin_chat_message import PinChatMessage
4141
from .promote_chat_member import PromoteChatMember
4242
from .restrict_chat_member import RestrictChatMember
43+
from .set_administrator_title import SetAdministratorTitle
4344
from .set_chat_description import SetChatDescription
4445
from .set_chat_permissions import SetChatPermissions
4546
from .set_chat_photo import SetChatPhoto
4647
from .set_chat_title import SetChatTitle
47-
from .set_custom_title import SetCustomTitle
4848
from .unarchive_chats import UnarchiveChats
4949
from .unban_chat_member import UnbanChatMember
5050
from .unpin_chat_message import UnpinChatMessage
@@ -84,6 +84,6 @@ class Chats(
8484
DeleteChannel,
8585
DeleteSupergroup,
8686
GetNearbyChats,
87-
SetCustomTitle
87+
SetAdministratorTitle
8888
):
8989
pass

pyrogram/client/methods/chats/set_custom_title.py renamed to pyrogram/client/methods/chats/set_administrator_title.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222
from ...ext import BaseClient
2323

2424

25-
class SetCustomTitle(BaseClient):
26-
def set_custom_title(
25+
class SetAdministratorTitle(BaseClient):
26+
def set_administrator_title(
2727
self,
2828
chat_id: Union[int, str],
2929
user_id: Union[int, str],
3030
title: str,
3131
) -> bool:
32-
"""Set a custom title to administrators or owners of a supergroup.
32+
"""Set a custom title (rank) to an administrator of a supergroup.
33+
34+
If you are an administrator of a supergroup (i.e. not the owner), you can only set the title of other
35+
administrators who have been promoted by you. If you are the owner, you can change every administrator's title.
3336
3437
Parameters:
3538
chat_id (``int`` | ``str``):
@@ -49,8 +52,7 @@ def set_custom_title(
4952
Example:
5053
.. code-block:: python
5154
52-
# Set custom titles to owners or administrators of supergroups
53-
app.set_custom_title(chat_id, user_id, "Custom Title")
55+
app.set_administrator_title(chat_id, user_id, "ฅ^•ﻌ•^ฅ")
5456
"""
5557
chat_id = self.resolve_peer(chat_id)
5658
user_id = self.resolve_peer(user_id)

0 commit comments

Comments
 (0)