From aa9b1072e4e4106bbd463c09642a419e5081f2bf Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Tue, 16 Jul 2024 17:03:37 +0300 Subject: [PATCH] Rename update_personal_channel to set_personal_channel --- compiler/docs/compiler.py | 2 +- pyrogram/methods/users/__init__.py | 4 ++-- ...nal_channel.py => set_personal_channel.py} | 24 ++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) rename pyrogram/methods/users/{update_personal_channel.py => set_personal_channel.py} (75%) diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 8f5f0091..1209f40c 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -274,6 +274,7 @@ def pyrogram_api(): get_chat_photos get_chat_photos_count set_profile_photo + set_personal_channel delete_profile_photos set_username update_profile @@ -285,7 +286,6 @@ def pyrogram_api(): update_status check_username update_birthday - update_personal_channel """, invite_links=""" Invite Links diff --git a/pyrogram/methods/users/__init__.py b/pyrogram/methods/users/__init__.py index cf34b434..9682bc7c 100644 --- a/pyrogram/methods/users/__init__.py +++ b/pyrogram/methods/users/__init__.py @@ -26,11 +26,11 @@ from .get_default_emoji_statuses import GetDefaultEmojiStatuses from .get_me import GetMe from .get_users import GetUsers from .set_emoji_status import SetEmojiStatus +from .set_personal_channel import SetPersonalChannel from .set_profile_photo import SetProfilePhoto from .set_username import SetUsername from .unblock_user import UnblockUser from .update_birthday import UpdateBirthday -from .update_personal_channel import UpdatePersonalChannel from .update_profile import UpdateProfile from .update_status import UpdateStatus @@ -40,6 +40,7 @@ class Users( CheckUsername, GetCommonChats, GetChatPhotos, + SetPersonalChannel, SetProfilePhoto, DeleteProfilePhotos, GetUsers, @@ -48,7 +49,6 @@ class Users( GetChatPhotosCount, UnblockUser, UpdateBirthday, - UpdatePersonalChannel, UpdateProfile, UpdateStatus, GetDefaultEmojiStatuses, diff --git a/pyrogram/methods/users/update_personal_channel.py b/pyrogram/methods/users/set_personal_channel.py similarity index 75% rename from pyrogram/methods/users/update_personal_channel.py rename to pyrogram/methods/users/set_personal_channel.py index 2b26c383..fb818629 100644 --- a/pyrogram/methods/users/update_personal_channel.py +++ b/pyrogram/methods/users/set_personal_channel.py @@ -16,25 +16,27 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from typing import Union +from typing import Union, Optional import pyrogram from pyrogram import raw -class UpdatePersonalChannel: - async def update_personal_channel( +class SetPersonalChannel: + async def set_personal_channel( self: "pyrogram.Client", - chat_id: Union[int, str] = None + chat_id: Optional[Union[int, str]] = None ) -> bool: - """Update your personal channel. + """Set a personal channel in bio. .. include:: /_includes/usable-by/users.rst + To get all available channels you can use + :meth:`~pyrogram.Client.get_personal_channels`. + Parameters: chat_id (``int`` | ``str``): - Unique identifier (int) or username (str) of the target user. - Use :meth:`~pyrogram.Client.get_personal_channels` to get available channels. + Unique identifier (int) or username (str) of the target user or None to remove it. Returns: ``bool``: True on success. @@ -42,18 +44,18 @@ class UpdatePersonalChannel: Example: .. code-block:: python - # Update your personal channel - await app.update_personal_channel(chat_id) + # Set your personal channel + await app.set_personal_channel(chat_id) # Remove personal channel from your profile - await app.update_personal_channel() + await app.set_personal_channel() """ if chat_id is None: peer = raw.types.InputChannelEmpty() else: peer = await self.resolve_peer(chat_id) - if not isinstance(peer, raw.types.InputChannel): + if not isinstance(peer, raw.types.InputPeerChannel): return False return bool(