mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Rename update- to set_username and set_chat_username
This commit is contained in:
parent
499822118f
commit
976c2c47a2
@ -212,7 +212,7 @@ def pyrogram_api():
|
||||
get_dialogs
|
||||
iter_dialogs
|
||||
get_dialogs_count
|
||||
update_chat_username
|
||||
set_chat_username
|
||||
get_nearby_chats
|
||||
archive_chats
|
||||
unarchive_chats
|
||||
@ -240,7 +240,7 @@ def pyrogram_api():
|
||||
iter_profile_photos
|
||||
set_profile_photo
|
||||
delete_profile_photos
|
||||
update_username
|
||||
set_username
|
||||
update_profile
|
||||
block_user
|
||||
unblock_user
|
||||
|
@ -50,13 +50,13 @@ from .set_chat_permissions import SetChatPermissions
|
||||
from .set_chat_photo import SetChatPhoto
|
||||
from .set_chat_protected_content import SetChatProtectedContent
|
||||
from .set_chat_title import SetChatTitle
|
||||
from .set_chat_username import SetChatUsername
|
||||
from .set_send_as_chat import SetSendAsChat
|
||||
from .set_slow_mode import SetSlowMode
|
||||
from .unarchive_chats import UnarchiveChats
|
||||
from .unban_chat_member import UnbanChatMember
|
||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .update_chat_username import UpdateChatUsername
|
||||
|
||||
|
||||
class Chats(
|
||||
@ -79,7 +79,7 @@ class Chats(
|
||||
GetChatMembersCount,
|
||||
IterDialogs,
|
||||
IterChatMembers,
|
||||
UpdateChatUsername,
|
||||
SetChatUsername,
|
||||
SetChatPermissions,
|
||||
GetDialogsCount,
|
||||
ArchiveChats,
|
||||
|
@ -22,19 +22,20 @@ from pyrogram import raw
|
||||
from pyrogram.scaffold import Scaffold
|
||||
|
||||
|
||||
class UpdateChatUsername(Scaffold):
|
||||
async def update_chat_username(
|
||||
class SetChatUsername(Scaffold):
|
||||
async def set_chat_username(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
username: Optional[str]
|
||||
) -> 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:
|
||||
chat_id (``int`` | ``str``)
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
|
||||
username (``str`` | ``None``):
|
||||
Username to set. Pass "" (empty string) or None to remove the username.
|
||||
|
||||
@ -47,7 +48,7 @@ class UpdateChatUsername(Scaffold):
|
||||
Example:
|
||||
.. 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)
|
@ -25,9 +25,9 @@ from .get_profile_photos_count import GetProfilePhotosCount
|
||||
from .get_users import GetUsers
|
||||
from .iter_profile_photos import IterProfilePhotos
|
||||
from .set_profile_photo import SetProfilePhoto
|
||||
from .set_username import SetUsername
|
||||
from .unblock_user import UnblockUser
|
||||
from .update_profile import UpdateProfile
|
||||
from .update_username import UpdateUsername
|
||||
|
||||
|
||||
class Users(
|
||||
@ -38,7 +38,7 @@ class Users(
|
||||
DeleteProfilePhotos,
|
||||
GetUsers,
|
||||
GetMe,
|
||||
UpdateUsername,
|
||||
SetUsername,
|
||||
GetProfilePhotosCount,
|
||||
IterProfilePhotos,
|
||||
UnblockUser,
|
||||
|
@ -22,16 +22,16 @@ from pyrogram import raw
|
||||
from pyrogram.scaffold import Scaffold
|
||||
|
||||
|
||||
class UpdateUsername(Scaffold):
|
||||
async def update_username(
|
||||
class SetUsername(Scaffold):
|
||||
async def set_username(
|
||||
self,
|
||||
username: Optional[str]
|
||||
) -> 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
|
||||
them from scratch using BotFather. To update a channel or supergroup username you can use
|
||||
:meth:`~pyrogram.Client.update_chat_username`.
|
||||
them from scratch using BotFather. To set a channel or supergroup username you can use
|
||||
:meth:`~pyrogram.Client.set_chat_username`.
|
||||
|
||||
Parameters:
|
||||
username (``str`` | ``None``):
|
||||
@ -43,7 +43,7 @@ class UpdateUsername(Scaffold):
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
app.update_username("new_username")
|
||||
app.set_username("new_username")
|
||||
"""
|
||||
|
||||
return bool(
|
Loading…
Reference in New Issue
Block a user