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 unban_chat_member
restrict_chat_member restrict_chat_member
promote_chat_member promote_chat_member
set_administrator_title
export_chat_invite_link export_chat_invite_link
set_chat_photo set_chat_photo
delete_chat_photo delete_chat_photo

View File

@ -40,11 +40,11 @@ from .leave_chat import LeaveChat
from .pin_chat_message import PinChatMessage from .pin_chat_message import PinChatMessage
from .promote_chat_member import PromoteChatMember from .promote_chat_member import PromoteChatMember
from .restrict_chat_member import RestrictChatMember from .restrict_chat_member import RestrictChatMember
from .set_administrator_title import SetAdministratorTitle
from .set_chat_description import SetChatDescription from .set_chat_description import SetChatDescription
from .set_chat_permissions import SetChatPermissions from .set_chat_permissions import SetChatPermissions
from .set_chat_photo import SetChatPhoto from .set_chat_photo import SetChatPhoto
from .set_chat_title import SetChatTitle from .set_chat_title import SetChatTitle
from .set_custom_title import SetCustomTitle
from .unarchive_chats import UnarchiveChats from .unarchive_chats import UnarchiveChats
from .unban_chat_member import UnbanChatMember from .unban_chat_member import UnbanChatMember
from .unpin_chat_message import UnpinChatMessage from .unpin_chat_message import UnpinChatMessage
@ -84,6 +84,6 @@ class Chats(
DeleteChannel, DeleteChannel,
DeleteSupergroup, DeleteSupergroup,
GetNearbyChats, GetNearbyChats,
SetCustomTitle SetAdministratorTitle
): ):
pass pass

View File

@ -22,14 +22,17 @@ from pyrogram.api import functions, types
from ...ext import BaseClient from ...ext import BaseClient
class SetCustomTitle(BaseClient): class SetAdministratorTitle(BaseClient):
def set_custom_title( def set_administrator_title(
self, self,
chat_id: Union[int, str], chat_id: Union[int, str],
user_id: Union[int, str], user_id: Union[int, str],
title: str, title: str,
) -> bool: ) -> 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: Parameters:
chat_id (``int`` | ``str``): chat_id (``int`` | ``str``):
@ -49,8 +52,7 @@ class SetCustomTitle(BaseClient):
Example: Example:
.. code-block:: python .. code-block:: python
# Set custom titles to owners or administrators of supergroups app.set_administrator_title(chat_id, user_id, "ฅ^•ﻌ•^ฅ")
app.set_custom_title(chat_id, user_id, "Custom Title")
""" """
chat_id = self.resolve_peer(chat_id) chat_id = self.resolve_peer(chat_id)
user_id = self.resolve_peer(user_id) user_id = self.resolve_peer(user_id)