Skip to content

Commit 976c2c4

Browse files
committed
Rename update- to set_username and set_chat_username
1 parent 4998221 commit 976c2c4

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

compiler/docs/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def get_title_list(s: str) -> list:
212212
get_dialogs
213213
iter_dialogs
214214
get_dialogs_count
215-
update_chat_username
215+
set_chat_username
216216
get_nearby_chats
217217
archive_chats
218218
unarchive_chats
@@ -240,7 +240,7 @@ def get_title_list(s: str) -> list:
240240
iter_profile_photos
241241
set_profile_photo
242242
delete_profile_photos
243-
update_username
243+
set_username
244244
update_profile
245245
block_user
246246
unblock_user

pyrogram/methods/chats/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
from .set_chat_photo import SetChatPhoto
5151
from .set_chat_protected_content import SetChatProtectedContent
5252
from .set_chat_title import SetChatTitle
53+
from .set_chat_username import SetChatUsername
5354
from .set_send_as_chat import SetSendAsChat
5455
from .set_slow_mode import SetSlowMode
5556
from .unarchive_chats import UnarchiveChats
5657
from .unban_chat_member import UnbanChatMember
5758
from .unpin_all_chat_messages import UnpinAllChatMessages
5859
from .unpin_chat_message import UnpinChatMessage
59-
from .update_chat_username import UpdateChatUsername
6060

6161

6262
class Chats(
@@ -79,7 +79,7 @@ class Chats(
7979
GetChatMembersCount,
8080
IterDialogs,
8181
IterChatMembers,
82-
UpdateChatUsername,
82+
SetChatUsername,
8383
SetChatPermissions,
8484
GetDialogsCount,
8585
ArchiveChats,

pyrogram/methods/chats/update_chat_username.py renamed to pyrogram/methods/chats/set_chat_username.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@
2222
from pyrogram.scaffold import Scaffold
2323

2424

25-
class UpdateChatUsername(Scaffold):
26-
async def update_chat_username(
25+
class SetChatUsername(Scaffold):
26+
async def set_chat_username(
2727
self,
2828
chat_id: Union[int, str],
2929
username: Optional[str]
3030
) -> bool:
31-
"""Update a channel or a supergroup username.
31+
"""Set a channel or a supergroup username.
3232
33-
To update your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.update_username`.
33+
To set your own username (for users only, not bots) you can use :meth:`~pyrogram.Client.set_username`.
3434
3535
Parameters:
3636
chat_id (``int`` | ``str``)
3737
Unique identifier (int) or username (str) of the target chat.
38+
3839
username (``str`` | ``None``):
3940
Username to set. Pass "" (empty string) or None to remove the username.
4041
@@ -47,7 +48,7 @@ async def update_chat_username(
4748
Example:
4849
.. code-block:: python
4950
50-
app.update_chat_username(chat_id, "new_username")
51+
app.set_chat_username(chat_id, "new_username")
5152
"""
5253

5354
peer = await self.resolve_peer(chat_id)

pyrogram/methods/users/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
from .get_users import GetUsers
2626
from .iter_profile_photos import IterProfilePhotos
2727
from .set_profile_photo import SetProfilePhoto
28+
from .set_username import SetUsername
2829
from .unblock_user import UnblockUser
2930
from .update_profile import UpdateProfile
30-
from .update_username import UpdateUsername
3131

3232

3333
class Users(
@@ -38,7 +38,7 @@ class Users(
3838
DeleteProfilePhotos,
3939
GetUsers,
4040
GetMe,
41-
UpdateUsername,
41+
SetUsername,
4242
GetProfilePhotosCount,
4343
IterProfilePhotos,
4444
UnblockUser,
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
from pyrogram.scaffold import Scaffold
2323

2424

25-
class UpdateUsername(Scaffold):
26-
async def update_username(
25+
class SetUsername(Scaffold):
26+
async def set_username(
2727
self,
2828
username: Optional[str]
2929
) -> bool:
30-
"""Update your own username.
30+
"""Set your own username.
3131
3232
This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating
33-
them from scratch using BotFather. To update a channel or supergroup username you can use
34-
:meth:`~pyrogram.Client.update_chat_username`.
33+
them from scratch using BotFather. To set a channel or supergroup username you can use
34+
:meth:`~pyrogram.Client.set_chat_username`.
3535
3636
Parameters:
3737
username (``str`` | ``None``):
@@ -43,7 +43,7 @@ async def update_username(
4343
Example:
4444
.. code-block:: python
4545
46-
app.update_username("new_username")
46+
app.set_username("new_username")
4747
"""
4848

4949
return bool(

0 commit comments

Comments
 (0)