Update pyUltroid/startup/funcs.py
Browse files- pyUltroid/startup/funcs.py +14 -10
pyUltroid/startup/funcs.py
CHANGED
|
@@ -314,17 +314,21 @@ async def autopilot():
|
|
| 314 |
LOGS.info("Error while promoting assistant in Log Channel..")
|
| 315 |
LOGS.exception(er)
|
| 316 |
if isinstance(chat.photo, ChatPhotoEmpty):
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
EditPhotoRequest(int(channel), InputChatUploadedPhoto(ll))
|
| 324 |
)
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
|
| 329 |
|
| 330 |
# customize assistant
|
|
|
|
| 314 |
LOGS.info("Error while promoting assistant in Log Channel..")
|
| 315 |
LOGS.exception(er)
|
| 316 |
if isinstance(chat.photo, ChatPhotoEmpty):
|
| 317 |
+
photo_path = "channelphoto.jpg"
|
| 318 |
+
if not os.path.exists(photo_path):
|
| 319 |
+
LOGS.info(f"{photo_path} not found, skipping channel photo upload.")
|
| 320 |
+
else:
|
| 321 |
+
photo, _ = await download_file(
|
| 322 |
+
"https://graph.org/file/27c6812becf6f376cbb10.jpg", photo_path
|
|
|
|
| 323 |
)
|
| 324 |
+
ll = await ultroid_bot.upload_file(photo)
|
| 325 |
+
try:
|
| 326 |
+
await ultroid_bot(
|
| 327 |
+
EditPhotoRequest(int(channel), InputChatUploadedPhoto(ll))
|
| 328 |
+
)
|
| 329 |
+
except BaseException as er:
|
| 330 |
+
LOGS.exception(er)
|
| 331 |
+
os.remove(photo)
|
| 332 |
|
| 333 |
|
| 334 |
# customize assistant
|