mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Rename update_personal_channel to set_personal_channel
This commit is contained in:
parent
0cda4f9c79
commit
aa9b1072e4
@ -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
|
||||
|
@ -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,
|
||||
|
@ -16,25 +16,27 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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(
|
Loading…
Reference in New Issue
Block a user