Jishu Developer commited on
Commit
38181e7
·
unverified ·
1 Parent(s): c0def97

Update start.py

Browse files
Files changed (1) hide show
  1. plugins/start.py +20 -8
plugins/start.py CHANGED
@@ -89,15 +89,17 @@ async def start_command(client: Client, message: Message):
89
  pass
90
 
91
 
92
- k = await client.send_message(chat_id = message.from_user.id, text=f"<b>❗️ <u>IMPORTANT</u> ❗️</b>\n\nThis Video / File Will Be Deleted In {file_auto_delete} (Due To Copyright Issues).\n\n📌 Please Forward This Video / File To Somewhere Else And Start Downloading There.")
93
- await asyncio.sleep(FILE_AUTO_DELETE)
 
 
94
 
95
- for madflix_msg in madflix_msgs:
96
- try:
97
- await madflix_msg.delete()
98
- await k.edit_text("Your Video / File Is Successfully Deleted ✅")
99
- except:
100
- pass
101
 
102
  return
103
  else:
@@ -222,6 +224,16 @@ async def send_text(client: Bot, message: Message):
222
 
223
 
224
 
 
 
 
 
 
 
 
 
 
 
225
 
226
 
227
  # Jishu Developer
 
89
  pass
90
 
91
 
92
+ # k = await client.send_message(chat_id = message.from_user.id, text=f"<b>❗️ <u>IMPORTANT</u> ❗️</b>\n\nThis Video / File Will Be Deleted In {file_auto_delete} (Due To Copyright Issues).\n\n📌 Please Forward This Video / File To Somewhere Else And Start Downloading There.")
93
+ await message.reply_text(f"Video / File Will Be Deleted After {file_auto_delete}. Please Forward Them Anywhere To Save Them.")
94
+ asyncio.create_task(delete_files(sent_messages, client))
95
+ # await asyncio.sleep(FILE_AUTO_DELETE)
96
 
97
+ # for madflix_msg in madflix_msgs:
98
+ # try:
99
+ # await madflix_msg.delete()
100
+ # await k.edit_text("Your Video / File Is Successfully Deleted ✅")
101
+ # except:
102
+ # pass
103
 
104
  return
105
  else:
 
224
 
225
 
226
 
227
+ # Function to handle file deletion
228
+ async def delete_files(messages, client):
229
+ await asyncio.sleep(FILE_AUTO_DELETE) # Wait for the duration specified in config.py
230
+ for msg in messages:
231
+ try:
232
+ await client.delete_messages(chat_id=msg.chat.id, message_ids=[msg.id])
233
+ except Exception as e:
234
+ print(f"The attempt to delete the media {msg.id} was unsuccessful: {e}")
235
+ await client.send_message(messages[0].chat.id, "Your Video / File Is Successfully Deleted ✅")
236
+
237
 
238
 
239
  # Jishu Developer