mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-31 22:35:36 +00:00
Rename update- to set_username and set_chat_username
This commit is contained in:
@@ -212,7 +212,7 @@ def pyrogram_api():
|
|||||||
get_dialogs
|
get_dialogs
|
||||||
iter_dialogs
|
iter_dialogs
|
||||||
get_dialogs_count
|
get_dialogs_count
|
||||||
update_chat_username
|
set_chat_username
|
||||||
get_nearby_chats
|
get_nearby_chats
|
||||||
archive_chats
|
archive_chats
|
||||||
unarchive_chats
|
unarchive_chats
|
||||||
@@ -240,7 +240,7 @@ def pyrogram_api():
|
|||||||
iter_profile_photos
|
iter_profile_photos
|
||||||
set_profile_photo
|
set_profile_photo
|
||||||
delete_profile_photos
|
delete_profile_photos
|
||||||
update_username
|
set_username
|
||||||
update_profile
|
update_profile
|
||||||
block_user
|
block_user
|
||||||
unblock_user
|
unblock_user
|
||||||
|
@@ -50,13 +50,13 @@ from .set_chat_permissions import SetChatPermissions
|
|||||||
from .set_chat_photo import SetChatPhoto
|
from .set_chat_photo import SetChatPhoto
|
||||||
from .set_chat_protected_content import SetChatProtectedContent
|
from .set_chat_protected_content import SetChatProtectedContent
|
||||||
from .set_chat_title import SetChatTitle
|
from .set_chat_title import SetChatTitle
|
||||||
|
from .set_chat_username import SetChatUsername
|
||||||
from .set_send_as_chat import SetSendAsChat
|
from .set_send_as_chat import SetSendAsChat
|
||||||
from .set_slow_mode import SetSlowMode
|
from .set_slow_mode import SetSlowMode
|
||||||
from .unarchive_chats import UnarchiveChats
|
from .unarchive_chats import UnarchiveChats
|
||||||
from .unban_chat_member import UnbanChatMember
|
from .unban_chat_member import UnbanChatMember
|
||||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||||
from .unpin_chat_message import UnpinChatMessage
|
from .unpin_chat_message import UnpinChatMessage
|
||||||
from .update_chat_username import UpdateChatUsername
|
|
||||||
|
|
||||||
|
|
||||||
class Chats(
|
class Chats(
|
||||||
@@ -79,7 +79,7 @@ class Chats(
|
|||||||
GetChatMembersCount,
|
GetChatMembersCount,
|
||||||
IterDialogs,
|
IterDialogs,
|
||||||
IterChatMembers,
|
IterChatMembers,
|
||||||
UpdateChatUsername,
|
SetChatUsername,
|
||||||
SetChatPermissions,
|
SetChatPermissions,
|
||||||
GetDialogsCount,
|
GetDialogsCount,
|
||||||
ArchiveChats,
|
ArchiveChats,
|
||||||
|
@@ -22,19 +22,20 @@ from pyrogram import raw
|
|||||||
from pyrogram.scaffold import Scaffold
|
from pyrogram.scaffold import Scaffold
|
||||||
|
|
||||||
|
|
||||||
class UpdateChatUsername(Scaffold):
|
class SetChatUsername(Scaffold):
|
||||||
async def update_chat_username(
|
async def set_chat_username(
|
||||||
self,
|
self,
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
username: Optional[str]
|
username: Optional[str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Update a channel or a supergroup username.
|
"""Set a channel or a supergroup username.
|
||||||
|
|
||||||
To update your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.update_username`.
|
To set your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.set_username`.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``)
|
chat_id (``int`` | ``str``)
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
username (``str`` | ``None``):
|
username (``str`` | ``None``):
|
||||||
Username to set. Pass "" (empty string) or None to remove the username.
|
Username to set. Pass "" (empty string) or None to remove the username.
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ class UpdateChatUsername(Scaffold):
|
|||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.update_chat_username(chat_id, "new_username")
|
app.set_chat_username(chat_id, "new_username")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
peer = await self.resolve_peer(chat_id)
|
peer = await self.resolve_peer(chat_id)
|
@@ -25,9 +25,9 @@ from .get_profile_photos_count import GetProfilePhotosCount
|
|||||||
from .get_users import GetUsers
|
from .get_users import GetUsers
|
||||||
from .iter_profile_photos import IterProfilePhotos
|
from .iter_profile_photos import IterProfilePhotos
|
||||||
from .set_profile_photo import SetProfilePhoto
|
from .set_profile_photo import SetProfilePhoto
|
||||||
|
from .set_username import SetUsername
|
||||||
from .unblock_user import UnblockUser
|
from .unblock_user import UnblockUser
|
||||||
from .update_profile import UpdateProfile
|
from .update_profile import UpdateProfile
|
||||||
from .update_username import UpdateUsername
|
|
||||||
|
|
||||||
|
|
||||||
class Users(
|
class Users(
|
||||||
@@ -38,7 +38,7 @@ class Users(
|
|||||||
DeleteProfilePhotos,
|
DeleteProfilePhotos,
|
||||||
GetUsers,
|
GetUsers,
|
||||||
GetMe,
|
GetMe,
|
||||||
UpdateUsername,
|
SetUsername,
|
||||||
GetProfilePhotosCount,
|
GetProfilePhotosCount,
|
||||||
IterProfilePhotos,
|
IterProfilePhotos,
|
||||||
UnblockUser,
|
UnblockUser,
|
||||||
|
@@ -22,16 +22,16 @@ from pyrogram import raw
|
|||||||
from pyrogram.scaffold import Scaffold
|
from pyrogram.scaffold import Scaffold
|
||||||
|
|
||||||
|
|
||||||
class UpdateUsername(Scaffold):
|
class SetUsername(Scaffold):
|
||||||
async def update_username(
|
async def set_username(
|
||||||
self,
|
self,
|
||||||
username: Optional[str]
|
username: Optional[str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Update your own username.
|
"""Set your own username.
|
||||||
|
|
||||||
This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating
|
This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating
|
||||||
them from scratch using BotFather. To update a channel or supergroup username you can use
|
them from scratch using BotFather. To set a channel or supergroup username you can use
|
||||||
:meth:`~pyrogram.Client.update_chat_username`.
|
:meth:`~pyrogram.Client.set_chat_username`.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
username (``str`` | ``None``):
|
username (``str`` | ``None``):
|
||||||
@@ -43,7 +43,7 @@ class UpdateUsername(Scaffold):
|
|||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.update_username("new_username")
|
app.set_username("new_username")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return bool(
|
return bool(
|
Reference in New Issue
Block a user