diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 93e71da6..6d940448 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -184,6 +184,7 @@ def pyrogram_api(): unban_chat_member restrict_chat_member promote_chat_member + set_administrator_title export_chat_invite_link set_chat_photo delete_chat_photo diff --git a/pyrogram/client/methods/chats/__init__.py b/pyrogram/client/methods/chats/__init__.py index b47385c4..67ade88a 100644 --- a/pyrogram/client/methods/chats/__init__.py +++ b/pyrogram/client/methods/chats/__init__.py @@ -40,11 +40,11 @@ from .leave_chat import LeaveChat from .pin_chat_message import PinChatMessage from .promote_chat_member import PromoteChatMember from .restrict_chat_member import RestrictChatMember +from .set_administrator_title import SetAdministratorTitle from .set_chat_description import SetChatDescription from .set_chat_permissions import SetChatPermissions from .set_chat_photo import SetChatPhoto from .set_chat_title import SetChatTitle -from .set_custom_title import SetCustomTitle from .unarchive_chats import UnarchiveChats from .unban_chat_member import UnbanChatMember from .unpin_chat_message import UnpinChatMessage @@ -84,6 +84,6 @@ class Chats( DeleteChannel, DeleteSupergroup, GetNearbyChats, - SetCustomTitle + SetAdministratorTitle ): pass diff --git a/pyrogram/client/methods/chats/set_custom_title.py b/pyrogram/client/methods/chats/set_administrator_title.py similarity index 86% rename from pyrogram/client/methods/chats/set_custom_title.py rename to pyrogram/client/methods/chats/set_administrator_title.py index f13e667a..9de1754f 100644 --- a/pyrogram/client/methods/chats/set_custom_title.py +++ b/pyrogram/client/methods/chats/set_administrator_title.py @@ -22,14 +22,17 @@ from pyrogram.api import functions, types from ...ext import BaseClient -class SetCustomTitle(BaseClient): - def set_custom_title( +class SetAdministratorTitle(BaseClient): + def set_administrator_title( self, chat_id: Union[int, str], user_id: Union[int, str], title: str, ) -> bool: - """Set a custom title to administrators or owners of a supergroup. + """Set a custom title (rank) to an administrator of a supergroup. + + If you are an administrator of a supergroup (i.e. not the owner), you can only set the title of other + administrators who have been promoted by you. If you are the owner, you can change every administrator's title. Parameters: chat_id (``int`` | ``str``): @@ -49,8 +52,7 @@ class SetCustomTitle(BaseClient): Example: .. code-block:: python - # Set custom titles to owners or administrators of supergroups - app.set_custom_title(chat_id, user_id, "Custom Title") + app.set_administrator_title(chat_id, user_id, "ฅ^•ﻌ•^ฅ") """ chat_id = self.resolve_peer(chat_id) user_id = self.resolve_peer(user_id)