Visitar URL original
Document set_chat_photo · usergao/pyrogram@3fe05b4 · GitHub
Skip to content

Commit 3fe05b4

Browse files
committed
Document set_chat_photo
1 parent 3fcf9b9 commit 3fe05b4

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

‎pyrogram/client/methods/chats/set_chat_photo.py‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,29 @@
2626

2727
class SetChatPhoto(BaseClient):
2828
def set_chat_photo(self, chat_id: int or str, photo: str):
29-
# TODO: Docstrings
29+
"""Use this method to set a new profile photo for the chat.
30+
Photos can't be changed for private chats.
31+
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
32+
33+
Note:
34+
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
35+
setting is off.
36+
37+
Args:
38+
chat_id (``int`` | ``str``):
39+
Unique identifier (int) or username (str) of the target chat.
40+
For a private channel/supergroup you can use its *t.me/joinchat/* link.
41+
42+
photo (``str``):
43+
New chat photo. You can pass a :class:`Photo` id or a file path to upload a new photo.
44+
45+
Returns:
46+
True on success.
47+
48+
Raises:
49+
:class:`Error <pyrogram.Error>`
50+
``ValueError``: If a chat_id belongs to user.
51+
"""
3052
peer = self.resolve_peer(chat_id)
3153

3254
if os.path.exists(photo):

0 commit comments

Comments
 (0)