mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 04:18:04 +00:00
Fix set_chat_photo not working because of new file ids
This commit is contained in:
parent
77e4128d54
commit
0011d12be5
@ -17,7 +17,6 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from struct import unpack
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from pyrogram.api import functions, types
|
from pyrogram.api import functions, types
|
||||||
@ -62,15 +61,8 @@ class SetChatPhoto(BaseClient):
|
|||||||
if os.path.exists(photo):
|
if os.path.exists(photo):
|
||||||
photo = types.InputChatUploadedPhoto(file=self.save_file(photo))
|
photo = types.InputChatUploadedPhoto(file=self.save_file(photo))
|
||||||
else:
|
else:
|
||||||
unpacked = unpack("<iiqqc", utils.decode(photo))
|
photo = utils.get_input_media_from_file_id(photo)
|
||||||
|
photo = types.InputChatPhoto(id=photo.id)
|
||||||
photo = types.InputChatPhoto(
|
|
||||||
id=types.InputPhoto(
|
|
||||||
id=unpacked[2],
|
|
||||||
access_hash=unpacked[3],
|
|
||||||
file_reference=b""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if isinstance(peer, types.InputPeerChat):
|
if isinstance(peer, types.InputPeerChat):
|
||||||
self.send(
|
self.send(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user