Rename set_custom_title to set_administrator_title and clarify

This commit is contained in:
Dan 2019-09-09 15:28:05 +02:00
parent a015f998fa
commit 80c7a6e988
3 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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)