mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Merge branch 'update-profile-photo' into develop
This commit is contained in:
commit
c7a38655c4
@ -96,7 +96,8 @@ Users
|
||||
get_me
|
||||
get_users
|
||||
get_user_profile_photos
|
||||
delete_profile_photos
|
||||
set_user_profile_photos
|
||||
delete_userprofile_photos
|
||||
|
||||
Contacts
|
||||
--------
|
||||
|
@ -16,15 +16,17 @@
|
||||
# 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 .delete_profile_photos import DeleteProfilePhotos
|
||||
from .delete_user_profile_photos import DeleteUserProfilePhotos
|
||||
from .get_me import GetMe
|
||||
from .get_user_profile_photos import GetUserProfilePhotos
|
||||
from .get_users import GetUsers
|
||||
from .set_user_profile_photo import SetUserProfilePhoto
|
||||
|
||||
|
||||
class Users(
|
||||
GetUserProfilePhotos,
|
||||
DeleteProfilePhotos,
|
||||
SetUserProfilePhoto,
|
||||
DeleteUserProfilePhotos,
|
||||
GetUsers,
|
||||
GetMe
|
||||
):
|
||||
|
@ -23,8 +23,8 @@ from pyrogram.api import functions, types
|
||||
from ...ext import BaseClient
|
||||
|
||||
|
||||
class DeleteProfilePhotos(BaseClient):
|
||||
def delete_profile_photos(self, id: str or list):
|
||||
class DeleteUserProfilePhotos(BaseClient):
|
||||
def delete_user_profile_photos(self, id: str or list):
|
||||
"""Use this method to delete your own profile photos
|
||||
|
||||
Args:
|
48
pyrogram/client/methods/users/set_user_profile_photo.py
Normal file
48
pyrogram/client/methods/users/set_user_profile_photo.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Pyrogram - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
|
||||
#
|
||||
# This file is part of Pyrogram.
|
||||
#
|
||||
# Pyrogram is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrogram is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# 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 pyrogram.api import functions
|
||||
from ...ext import BaseClient
|
||||
|
||||
|
||||
class SetUserProfilePhoto(BaseClient):
|
||||
def set_user_profile_photo(self, photo: str):
|
||||
"""Use this method to set a new profile photo.
|
||||
|
||||
This method only works for Users.
|
||||
Bots profile photos must be set using BotFather.
|
||||
|
||||
Args:
|
||||
photo (``str``):
|
||||
Profile photo to set.
|
||||
Pass a file path as string to upload a new photo that exists on your local machine.
|
||||
|
||||
Returns:
|
||||
True on success.
|
||||
|
||||
Raises:
|
||||
:class:`Error <pyrogram.Error>`
|
||||
"""
|
||||
|
||||
return bool(
|
||||
self.send(
|
||||
functions.photos.UploadProfilePhoto(
|
||||
self.save_file(photo)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user