xdragxt commited on
Commit
f488d15
·
verified ·
1 Parent(s): 1f4d7cb

Update pyUltroid/startup/funcs.py

Browse files
Files changed (1) hide show
  1. 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
- photo, _ = await download_file(
318
- "https://graph.org/file/27c6812becf6f376cbb10.jpg", "channelphoto.jpg"
319
- )
320
- ll = await ultroid_bot.upload_file(photo)
321
- try:
322
- await ultroid_bot(
323
- EditPhotoRequest(int(channel), InputChatUploadedPhoto(ll))
324
  )
325
- except BaseException as er:
326
- LOGS.exception(er)
327
- os.remove(photo)
 
 
 
 
 
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