From f54b163827835721fd60cf6ae3a54333f00a6cdd Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:37:05 +0530 Subject: [PATCH 01/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index ef3b6db..1aa3d57 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,5 +40,5 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) From 668685361de6fbda9046cf5b18295363747f7600 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:40:06 +0530 Subject: [PATCH 02/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 1aa3d57..ef3b6db 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,5 +40,5 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) From 1d89166472d99e673add40692c0d87f53c70607f Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:40:59 +0530 Subject: [PATCH 03/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index ef3b6db..1aa3d57 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,5 +40,5 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) From 5c228e043bcdec706767b7026a1f3b58f38cbeaa Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:46:59 +0530 Subject: [PATCH 04/88] Update send_file.py --- handlers/send_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 1aa3d57..d342af9 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,5 +40,6 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + file = asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) + await file.delete() From cbacadceff063e0cb6569bdf528ccfb1e03d239f Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:49:10 +0530 Subject: [PATCH 05/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index d342af9..737ec9c 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,6 +40,6 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - file = asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) - await file.delete() + await file_id.delete() From 02b4fe4fb84719666f14b7fbc0c8bbcb3f28539a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:51:25 +0530 Subject: [PATCH 06/88] Update send_file.py --- handlers/send_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 737ec9c..24c859b 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -39,7 +39,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - await reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + n = await reply_forward(message=sent_message, file_id=file_id) + await n.delete() # schedule the file deletion task await asyncio.sleep(2) - await file_id.delete() + From 6879c03675b7aa3a41ef9c661d08b1e1f098331a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:55:26 +0530 Subject: [PATCH 07/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 24c859b..45cf55d 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -38,8 +38,8 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): - sent_message = await media_forward(bot, user_id, file_id) - n = await reply_forward(message=sent_message, file_id=file_id) + n = sent_message = await media_forward(bot, user_id, file_id) + await reply_forward(message=sent_message, file_id=file_id) await n.delete() # schedule the file deletion task await asyncio.sleep(2) From acc269aa1520a669a913d15b55f1d10b70b7ac55 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:57:07 +0530 Subject: [PATCH 08/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 45cf55d..d4d85a5 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,6 +40,6 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await n.delete() # schedule the file deletion task + # schedule the file deletion task await asyncio.sleep(2) - + await n.delete() From 5c2f07059c8f275d905e2e779f3e996eb0dc8b4b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 20:58:00 +0530 Subject: [PATCH 09/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index d4d85a5..05c3900 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,5 +41,5 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) # schedule the file deletion task - await asyncio.sleep(2) + await asyncio.sleep(20) await n.delete() From a1bf395a3c729c3020e44ddf8cc3cd4dc92a70d7 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:01:35 +0530 Subject: [PATCH 10/88] Update send_file.py --- handlers/send_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 05c3900..dd89dbc 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -32,7 +32,7 @@ async def media_forward(bot: Client, user_id: int, file_id: int): async def delete_file(file_id: int): - await asyncio.sleep(50) # wait for 50 seconds + await asyncio.sleep(20) # wait for 50 seconds # Delete the file using the file ID # Code to delete the file goes here @@ -40,6 +40,6 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - # schedule the file deletion task - await asyncio.sleep(20) + asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await asyncio.sleep(60) await n.delete() From e5ee2b7dc0c3a0eae3968f3a09c2861b1d398f1c Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:06:27 +0530 Subject: [PATCH 11/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index dd89dbc..815275c 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,5 +41,5 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) asyncio.create_task(delete_file(file_id)) # schedule the file deletion task - await asyncio.sleep(60) - await n.delete() + asyncio.sleep(60) + n.delete() From 63edc80c4f591a0da2408685ebb374c7434e8bbf Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:07:08 +0530 Subject: [PATCH 12/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 815275c..8d38c2b 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,5 +41,5 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) asyncio.create_task(delete_file(file_id)) # schedule the file deletion task - asyncio.sleep(60) n.delete() + asyncio.sleep(60) From dda95dac390436e02e3f84b04e60c74cee13fa2a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:07:52 +0530 Subject: [PATCH 13/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 8d38c2b..39c2fd0 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -42,4 +42,4 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): await reply_forward(message=sent_message, file_id=file_id) asyncio.create_task(delete_file(file_id)) # schedule the file deletion task n.delete() - asyncio.sleep(60) + await asyncio.sleep(60) From ef6f57c90dd4b294e4ea7498f268020bdf71d3f2 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:10:00 +0530 Subject: [PATCH 14/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 39c2fd0..84a97a7 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,6 +40,6 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): n = sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task n.delete() await asyncio.sleep(60) From 9602dfff9c63f5748739d42dad5140bc74742eeb Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:40:18 +0530 Subject: [PATCH 15/88] Update send_file.py --- handlers/send_file.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 84a97a7..b7cc781 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -38,8 +38,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): - n = sent_message = await media_forward(bot, user_id, file_id) + sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task - n.delete() - await asyncio.sleep(60) + asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await asyncio.sleep(2) From 70064234d5804624b788bf45ca9685380d3f0efb Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:45:33 +0530 Subject: [PATCH 16/88] Update bot.py --- bot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bot.py b/bot.py index 79771c4..4c3994f 100644 --- a/bot.py +++ b/bot.py @@ -1,6 +1,7 @@ #@MxA_Bots | @iSmartBoi_Ujjwal import os +import time import asyncio import traceback from binascii import ( @@ -110,6 +111,17 @@ async def start(bot: Client, cmd: Message): except Exception as err: await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") + def send_files(bot, chat_id, file_ids): + for file_id in file_ids: + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_document(chat_id=chat_id, document=file_id) + # Wait for 30 seconds before sending the next file + time.sleep(30) + + # Delete all files after the last file has been sent + for file_id in file_ids: + bot.delete_message(chat_id=chat_id, message_id=file_id) + @Bot.on_message((filters.document | filters.video | filters.audio) & ~filters.chat(Config.DB_CHANNEL)) async def main(bot: Client, message: Message): From affaf3824af1630fa68c0e566ca1e9401b2c9f5b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 22:35:20 +0530 Subject: [PATCH 17/88] Update bot.py --- bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bot.py b/bot.py index 4c3994f..e743dbd 100644 --- a/bot.py +++ b/bot.py @@ -111,6 +111,13 @@ async def start(bot: Client, cmd: Message): except Exception as err: await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") + def bot(): + + def send_file(chat_id, file_id): + + for file_id in file_ids: + send_file(chat_id, file_id) + def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) From e74fa08efed6b6a104ca26f950fb2a8d925f11a5 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 22:43:06 +0530 Subject: [PATCH 18/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index e743dbd..0e0e882 100644 --- a/bot.py +++ b/bot.py @@ -118,7 +118,7 @@ def send_file(chat_id, file_id): for file_id in file_ids: send_file(chat_id, file_id) - def send_files(bot, chat_id, file_ids): + def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) From 6560add9c1ccd1f3e1e1d3066aa22328c980898d Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:11:18 +0530 Subject: [PATCH 19/88] Update bot.py --- bot.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index 0e0e882..0048549 100644 --- a/bot.py +++ b/bot.py @@ -111,14 +111,12 @@ async def start(bot: Client, cmd: Message): except Exception as err: await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") - def bot(): - - def send_file(chat_id, file_id): - - for file_id in file_ids: + def bot(): + def send_file(chat_id, file_id + for file_id in file_ids: send_file(chat_id, file_id) - def send_files(bot, chat_id, file_ids): + def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) From fafab4fb50a65e0e520fe629f3d6b0294adef92e Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:14:21 +0530 Subject: [PATCH 20/88] Update bot.py --- bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 0048549..4b803b1 100644 --- a/bot.py +++ b/bot.py @@ -112,10 +112,13 @@ async def start(bot: Client, cmd: Message): await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") def bot(): - def send_file(chat_id, file_id + + def send_file(chat_id, file_id): + + for file_id in file_ids: send_file(chat_id, file_id) - + def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) From 2a93220b23729b236f5f8c8295c30e0601ec1b07 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:18:55 +0530 Subject: [PATCH 21/88] Update bot.py --- bot.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/bot.py b/bot.py index 4b803b1..51d4db4 100644 --- a/bot.py +++ b/bot.py @@ -109,27 +109,7 @@ async def start(bot: Client, cmd: Message): for i in range(len(message_ids)): await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) except Exception as err: - await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") - - def bot(): - - def send_file(chat_id, file_id): - - - for file_id in file_ids: - send_file(chat_id, file_id) - - def send_files(bot, chat_id, file_ids): - for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) - bot.send_document(chat_id=chat_id, document=file_id) - # Wait for 30 seconds before sending the next file - time.sleep(30) - - # Delete all files after the last file has been sent - for file_id in file_ids: - bot.delete_message(chat_id=chat_id, message_id=file_id) - + await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") @Bot.on_message((filters.document | filters.video | filters.audio) & ~filters.chat(Config.DB_CHANNEL)) async def main(bot: Client, message: Message): From 293e4afe1e9289801b668f5f1f6a891a8daaad95 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:08:45 +0530 Subject: [PATCH 22/88] Update send_file.py --- handlers/send_file.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/handlers/send_file.py b/handlers/send_file.py index b7cc781..77e54bd 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -42,3 +42,14 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): await reply_forward(message=sent_message, file_id=file_id) asyncio.create_task(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) + +async def send_files(bot, chat_id, file_ids): + for file_id in file_ids: + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_document(chat_id=chat_id, document=file_id) + # Wait for 30 seconds before sending the next file + time.sleep(30) + + # Delete all files after the last file has been sent + for file_id in file_ids: + bot.delete_message(chat_id=chat_id, message_id=file_id) From b7dc7f4ccb9163d982fe75d934b62a04c98da0d1 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:09:52 +0530 Subject: [PATCH 23/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 77e54bd..3b7c28a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + bot.delete_message(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(2) async def send_files(bot, chat_id, file_ids): From 313ee7bf175b41561fd8e68a03fb54a5ea2e6e56 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:15:12 +0530 Subject: [PATCH 24/88] Update send_file.py --- handlers/send_file.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 3b7c28a..14f5cc6 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -6,7 +6,8 @@ from pyrogram.types import Message from pyrogram.errors import FloodWait from handlers.helpers import str_to_b64 - +from bot import bot +import time async def reply_forward(message: Message, file_id: int): try: @@ -32,7 +33,7 @@ async def media_forward(bot: Client, user_id: int, file_id: int): async def delete_file(file_id: int): - await asyncio.sleep(20) # wait for 50 seconds + await asyncio.sleep(20) # wait for 20 seconds # Delete the file using the file ID # Code to delete the file goes here @@ -40,8 +41,8 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - bot.delete_message(delete_file(file_id)) # schedule the file deletion task - await asyncio.sleep(2) + await sent_message.delete(delete_file(file_id)) # schedule the file deletion task + await asyncio.sleep(20) async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From a03072a60b0cbdc74b2f6a6053cf017b62c2e993 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:05:59 +0530 Subject: [PATCH 25/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 51d4db4..1e2877f 100644 --- a/bot.py +++ b/bot.py @@ -26,7 +26,7 @@ from configs import Config from handlers.database import db from handlers.add_user_to_db import add_user_to_database -from handlers.send_file import send_media_and_reply +from FilestorePro.handlers.send_file import send_media_and_reply from handlers.helpers import b64_to_str, str_to_b64 from handlers.check_user_status import handle_user_status from handlers.force_sub_handler import ( From 1ba883ccbd7a5a41c2c335e78ac7600ca73cf575 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:17:20 +0530 Subject: [PATCH 26/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 1e2877f..51d4db4 100644 --- a/bot.py +++ b/bot.py @@ -26,7 +26,7 @@ from configs import Config from handlers.database import db from handlers.add_user_to_db import add_user_to_database -from FilestorePro.handlers.send_file import send_media_and_reply +from handlers.send_file import send_media_and_reply from handlers.helpers import b64_to_str, str_to_b64 from handlers.check_user_status import handle_user_status from handlers.force_sub_handler import ( From 51d28ec99ec532fe1e8d902a814ed6b79f4e2bb4 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:36:18 +0530 Subject: [PATCH 27/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 14f5cc6..bbffa91 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -38,7 +38,7 @@ async def delete_file(file_id: int): # Code to delete the file goes here -async def send_media_and_reply(bot: Client, user_id: int, file_id: int): +async def send_media_and_replies(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) await sent_message.delete(delete_file(file_id)) # schedule the file deletion task @@ -46,7 +46,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): async def send_files(bot, chat_id, file_ids): for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.SEND_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) # Wait for 30 seconds before sending the next file time.sleep(30) From 499297a7561acfb611e68a3a9623f9aadbbdd836 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:36:47 +0530 Subject: [PATCH 28/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 51d4db4..01d5189 100644 --- a/bot.py +++ b/bot.py @@ -26,7 +26,7 @@ from configs import Config from handlers.database import db from handlers.add_user_to_db import add_user_to_database -from handlers.send_file import send_media_and_reply +from handlers.send_file import send_media_and_replies from handlers.helpers import b64_to_str, str_to_b64 from handlers.check_user_status import handle_user_status from handlers.force_sub_handler import ( From 0dc2f61553a4135808e1e78b75385bc6fc253980 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:38:16 +0530 Subject: [PATCH 29/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 01d5189..51d4db4 100644 --- a/bot.py +++ b/bot.py @@ -26,7 +26,7 @@ from configs import Config from handlers.database import db from handlers.add_user_to_db import add_user_to_database -from handlers.send_file import send_media_and_replies +from handlers.send_file import send_media_and_reply from handlers.helpers import b64_to_str, str_to_b64 from handlers.check_user_status import handle_user_status from handlers.force_sub_handler import ( From 2b834366babe667eca5bd3e26afe5039f77a35f6 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:38:49 +0530 Subject: [PATCH 30/88] Update send_file.py --- handlers/send_file.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index bbffa91..4752aac 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -6,7 +6,6 @@ from pyrogram.types import Message from pyrogram.errors import FloodWait from handlers.helpers import str_to_b64 -from bot import bot import time async def reply_forward(message: Message, file_id: int): @@ -38,7 +37,7 @@ async def delete_file(file_id: int): # Code to delete the file goes here -async def send_media_and_replies(bot: Client, user_id: int, file_id: int): +async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) await sent_message.delete(delete_file(file_id)) # schedule the file deletion task From f6dd8b23a11901e7566aef335a2b5f6e8f1eef5c Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:41:03 +0530 Subject: [PATCH 31/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 4752aac..bd80f3c 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await sent_message.delete(delete_file(file_id)) # schedule the file deletion task + await message.delete(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(20) async def send_files(bot, chat_id, file_ids): From ca735d5669f45bb857c7302b5f15b88a6db104e9 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:42:17 +0530 Subject: [PATCH 32/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index bd80f3c..d0d808a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await message.delete(delete_file(file_id)) # schedule the file deletion task + await Message.delete(delete_file(file_id)) # schedule the file deletion task await asyncio.sleep(20) async def send_files(bot, chat_id, file_ids): From 8b63c15fbe2cf7418c724725b3e77ca80aba0cc8 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 01:47:33 +0530 Subject: [PATCH 33/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index d0d808a..591440a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) await Message.delete(delete_file(file_id)) # schedule the file deletion task - await asyncio.sleep(20) + time.sleep(2) async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From b24a6541ae2115fcea104a5fb9d0d1e3094cd58f Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 11:04:08 +0530 Subject: [PATCH 34/88] Update send_file.py --- handlers/send_file.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 591440a..6ebbe26 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,16 +40,8 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) + time.sleep(0.5) + return sent_message await Message.delete(delete_file(file_id)) # schedule the file deletion task - time.sleep(2) - -async def send_files(bot, chat_id, file_ids): - for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.SEND_DOCUMENT) - bot.send_document(chat_id=chat_id, document=file_id) - # Wait for 30 seconds before sending the next file - time.sleep(30) - - # Delete all files after the last file has been sent - for file_id in file_ids: - bot.delete_message(chat_id=chat_id, message_id=file_id) + + From c638bf0e7d16e8edac011ea520d077cd38852b66 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 11:05:42 +0530 Subject: [PATCH 35/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 6ebbe26..3a2c960 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -39,9 +39,9 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - await reply_forward(message=sent_message, file_id=file_id) time.sleep(0.5) return sent_message + await reply_forward(message=sent_message, file_id=file_id) await Message.delete(delete_file(file_id)) # schedule the file deletion task From 0807ce0cd9f167eb495e1bc8f047b8aab397b006 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 11:09:55 +0530 Subject: [PATCH 36/88] Update send_file.py --- handlers/send_file.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 3a2c960..5b4c974 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,8 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) time.sleep(0.5) return sent_message - await reply_forward(message=sent_message, file_id=file_id) - await Message.delete(delete_file(file_id)) # schedule the file deletion task + continue + reply_forward(message=sent_message, file_id=file_id) + asyncio.create_task(delete_file(file_id)) # schedule the file deletion task From b9142bfaa1f5a4ab755892bf6741e78f1609dd02 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 12:40:00 +0530 Subject: [PATCH 37/88] Update send_file.py --- handlers/send_file.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 5b4c974..827de7d 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,9 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) time.sleep(0.5) - return sent_message - continue - reply_forward(message=sent_message, file_id=file_id) - asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + return reply_forward(message=sent_message, file_id=file_id) + await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task From cd7dabfd4593103a973440b49325184dbeee5405 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 12:46:56 +0530 Subject: [PATCH 38/88] Update send_file.py --- handlers/send_file.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 827de7d..f20c66f 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -39,8 +39,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - time.sleep(0.5) - return reply_forward(message=sent_message, file_id=file_id) + reply_forward(message=sent_message, file_id=file_id) await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task From b81f4e9df82a93775ee5332da962d8dcf22b4542 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:07:29 +0530 Subject: [PATCH 39/88] Update send_file.py --- handlers/send_file.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index f20c66f..06471e6 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -39,7 +39,16 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - reply_forward(message=sent_message, file_id=file_id) + await reply_forward(message=sent_message, file_id=file_id) await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task - - + + def send_files(bot, chat_id, file_ids): + for file_id in file_ids: + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_document(chat_id=chat_id, document=file_id) + # Wait for 30 seconds before sending the next file + time.sleep(30) + + # Delete all files after the last file has been sent + for file_id in file_ids: + bot.delete_message(chat_id=chat_id, message_id=file_id) From 0ff3c5f040451ad1b410f84381e3963d34ed0bf4 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:10:17 +0530 Subject: [PATCH 40/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 06471e6..1205f00 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,8 +41,8 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task - - def send_files(bot, chat_id, file_ids): +else: +async def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) From a467fed8100c51e62ccc45891dedec0388c00734 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:13:48 +0530 Subject: [PATCH 41/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 1205f00..da6a21a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task -else: + async def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) From c28b1f7fcf9f2996459e8debe4c94fb62f712504 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:18:29 +0530 Subject: [PATCH 42/88] Update send_file.py --- handlers/send_file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index da6a21a..e9d6edc 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -32,7 +32,7 @@ async def media_forward(bot: Client, user_id: int, file_id: int): async def delete_file(file_id: int): - await asyncio.sleep(20) # wait for 20 seconds + await asyncio.sleep(10) # wait for 20 seconds # Delete the file using the file ID # Code to delete the file goes here @@ -46,9 +46,9 @@ async def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) - # Wait for 30 seconds before sending the next file + # Wait for 30 seconds before deleting files time.sleep(30) # Delete all files after the last file has been sent for file_id in file_ids: - bot.delete_message(chat_id=chat_id, message_id=file_id) + await bot.delete_message(chat_id=chat_id, message_id=file_id) From f360aea514dc60d58ea1eaf46ff2627fd710b70a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:20:26 +0530 Subject: [PATCH 43/88] Update send_file.py --- handlers/send_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index e9d6edc..ea4060b 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -44,11 +44,11 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): async def send_files(bot, chat_id, file_ids): for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.SEND_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) # Wait for 30 seconds before deleting files time.sleep(30) # Delete all files after the last file has been sent for file_id in file_ids: - await bot.delete_message(chat_id=chat_id, message_id=file_id) + bot.delete_message(chat_id=chat_id, message_id=file_id) From 9b4313e1e0094a13e3f433bad3c5b90fb2cfecd5 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:25:08 +0530 Subject: [PATCH 44/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index ea4060b..17a7d3f 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await asyncio.create_task(delete_file(file_id)) # schedule the file deletion task + await bot.delete_message(chat_id=chat_id, message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From a0378607744842e74bc9996719fe30f1bab13e55 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:27:53 +0530 Subject: [PATCH 45/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 17a7d3f..885efc5 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,7 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await bot.delete_message(chat_id=chat_id, message_id=file_id) # schedule the file deletion task + await bot.delete_sent_message(chat_id=chat_id, message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 1d4bdbd3d071c8bbaeffff8567f14019d97651a5 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:30:04 +0530 Subject: [PATCH 46/88] Update send_file.py --- handlers/send_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 885efc5..4bdeabd 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -40,7 +40,8 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) - await bot.delete_sent_message(chat_id=chat_id, message_id=file_id) # schedule the file deletion task + time.sleep(5) + await bot.sent_message.delete(chat_id=chat_id, message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 15ca27a16e78e69a20ff0aa7a898df0f7ce5bd1a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:32:14 +0530 Subject: [PATCH 47/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 4bdeabd..6b482ac 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) time.sleep(5) - await bot.sent_message.delete(chat_id=chat_id, message_id=file_id) # schedule the file deletion task + await sent_message.delete(chat_id=chat_id, message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 559f5d2cf75b9e2287999a6b01961c80fedacbb7 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:34:02 +0530 Subject: [PATCH 48/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 6b482ac..b6ba6a5 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) time.sleep(5) - await sent_message.delete(chat_id=chat_id, message_id=file_id) # schedule the file deletion task + await sent_message.delete(chat_id=user_id, message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 4f7c6d69415d50012184cca84be3796d92730291 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:35:41 +0530 Subject: [PATCH 49/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index b6ba6a5..50c52af 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) time.sleep(5) - await sent_message.delete(chat_id=user_id, message_id=file_id) # schedule the file deletion task + await sent_message.delete(message_id=file_id) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 87fed8dada2702cd3be95fe18a5b1075a5398d53 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:37:50 +0530 Subject: [PATCH 50/88] Update send_file.py --- handlers/send_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 50c52af..fc32405 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,7 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) await reply_forward(message=sent_message, file_id=file_id) time.sleep(5) - await sent_message.delete(message_id=file_id) # schedule the file deletion task + await sent_message.delete(delete_file(file_id=file_id)) # schedule the file deletion task async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From fe58e3d47218bce6181b8b3ab7c0aa706aebdefb Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:31:12 +0530 Subject: [PATCH 51/88] Update send_file.py --- handlers/send_file.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index fc32405..badf24a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -43,13 +43,13 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): time.sleep(5) await sent_message.delete(delete_file(file_id=file_id)) # schedule the file deletion task -async def send_files(bot, chat_id, file_ids): +async def send_files(bot, user_id, file_ids): for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.SEND_DOCUMENT) - bot.send_document(chat_id=chat_id, document=file_id) + bot.send_chat_action(user_id=user_id, action=telegram.ChatAction.SEND_DOCUMENT) + bot.send_document(user_id=user_id, document=file_id) # Wait for 30 seconds before deleting files time.sleep(30) # Delete all files after the last file has been sent for file_id in file_ids: - bot.delete_message(chat_id=chat_id, message_id=file_id) + bot.delete_message(user_id=user_id, message_id=file_id) From cbc7dfd20a8de24b1bc9b41d2c4f406d9a831d5b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:38:24 +0530 Subject: [PATCH 52/88] Update bot.py --- bot.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/bot.py b/bot.py index 51d4db4..6b9cb79 100644 --- a/bot.py +++ b/bot.py @@ -99,17 +99,29 @@ async def start(bot: Client, cmd: Message): message_ids = [] if GetMessage.text: message_ids = GetMessage.text.split(" ") - _response_msg = await cmd.reply_text( - text=f"**Total Files:** `{len(message_ids)}`", - quote=True, - disable_web_page_preview=True - ) + #_response_msg = await cmd.reply_text( + #text=f"**Total Files:** `{len(message_ids)}`", + # quote=True, + # disable_web_page_preview=True + # ) else: - message_ids.append(int(GetMessage.id)) - for i in range(len(message_ids)): + #message_ids.append(int(GetMessage.id)) + # for i in range(len(message_ids)): await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) - except Exception as err: - await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") + # except Exception as err: + # await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") +async def send_files(bot, user_id, file_ids): + for file_id in file_ids: + bot.send_chat_action(user_id=user_id, action=telegram.ChatAction.SEND_DOCUMENT) + bot.send_document(user_id=user_id, document=file_id) + # Wait for 30 seconds before deleting files + time.sleep(30) + + # Delete all files after the last file has been sent + for file_id in file_ids: + bot.delete_message(user_id=user_id, message_id=file_id) + + @Bot.on_message((filters.document | filters.video | filters.audio) & ~filters.chat(Config.DB_CHANNEL)) async def main(bot: Client, message: Message): From 2ec16f9cce03cc1498be593f0f68235897f439b1 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:39:15 +0530 Subject: [PATCH 53/88] Update send_file.py --- handlers/send_file.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index badf24a..81edc5a 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -39,17 +39,17 @@ async def delete_file(file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - await reply_forward(message=sent_message, file_id=file_id) - time.sleep(5) - await sent_message.delete(delete_file(file_id=file_id)) # schedule the file deletion task - -async def send_files(bot, user_id, file_ids): - for file_id in file_ids: - bot.send_chat_action(user_id=user_id, action=telegram.ChatAction.SEND_DOCUMENT) - bot.send_document(user_id=user_id, document=file_id) + # await reply_forward(message=sent_message, file_id=file_id) + time.sleep(1) + #await sent_message.delete(delete_file(file_id=file_id)) # schedule the file deletion task + +#async def send_files(bot, user_id, file_ids): + #for file_id in file_ids: + # bot.send_chat_action(user_id=user_id, action=telegram.ChatAction.SEND_DOCUMENT) + # bot.send_document(user_id=user_id, document=file_id) # Wait for 30 seconds before deleting files - time.sleep(30) + # time.sleep(30) - # Delete all files after the last file has been sent - for file_id in file_ids: - bot.delete_message(user_id=user_id, message_id=file_id) + # # Delete all files after the last file has been sent + # for file_id in file_ids: + # bot.delete_message(user_id=user_id, message_id=file_id) From f5f42604d6b9b71d2289675c0b0f4accf2e0cc77 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:42:20 +0530 Subject: [PATCH 54/88] Update bot.py --- bot.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 6b9cb79..0d0dc49 100644 --- a/bot.py +++ b/bot.py @@ -110,16 +110,20 @@ async def start(bot: Client, cmd: Message): await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: # await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") -async def send_files(bot, user_id, file_ids): + +def send_files(bot, chat_id, file_ids): for file_id in file_ids: - bot.send_chat_action(user_id=user_id, action=telegram.ChatAction.SEND_DOCUMENT) - bot.send_document(user_id=user_id, document=file_id) - # Wait for 30 seconds before deleting files + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) + bot.send_document(chat_id=chat_id, document=file_id) + # Wait for 30 seconds before deleting the file. time.sleep(30) # Delete all files after the last file has been sent for file_id in file_ids: - bot.delete_message(user_id=user_id, message_id=file_id) + bot.delete_message(chat_id=chat_id, message_id=file_id) + + + From da74031733c33cd3b4311d83f223e27b74ed2f0d Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:46:20 +0530 Subject: [PATCH 55/88] Update bot.py --- bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 0d0dc49..299365b 100644 --- a/bot.py +++ b/bot.py @@ -121,7 +121,8 @@ def send_files(bot, chat_id, file_ids): # Delete all files after the last file has been sent for file_id in file_ids: bot.delete_message(chat_id=chat_id, message_id=file_id) - + except: + pass From b52303ca15bb0be427de01cf21ee93ba48520599 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:49:19 +0530 Subject: [PATCH 56/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 299365b..8cf87ab 100644 --- a/bot.py +++ b/bot.py @@ -111,7 +111,7 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") -def send_files(bot, chat_id, file_ids): +async def send_files(bot, chat_id, file_ids): for file_id in file_ids: bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) bot.send_document(chat_id=chat_id, document=file_id) From 7e3ede00c523a9c26e8b7b1d78d4335721a7ce2c Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:55:04 +0530 Subject: [PATCH 57/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 8cf87ab..2abd116 100644 --- a/bot.py +++ b/bot.py @@ -109,7 +109,7 @@ async def start(bot: Client, cmd: Message): # for i in range(len(message_ids)): await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: - # await cmd.reply_text(f"Something went wrong!\n\n**Error:** `{err}`") + await cmd.reply_text("files will delete after few seconds") async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From b21f24c7ad846d2327c687e3bf211da3a59c2248 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:57:51 +0530 Subject: [PATCH 58/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 2abd116..0799979 100644 --- a/bot.py +++ b/bot.py @@ -109,7 +109,7 @@ async def start(bot: Client, cmd: Message): # for i in range(len(message_ids)): await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: - await cmd.reply_text("files will delete after few seconds") + await cmd.reply_text('files will delete after few seconds') async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From ee3eb436ee2c83094166da415507826220f6c00b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:59:08 +0530 Subject: [PATCH 59/88] Update bot.py --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 0799979..f6b89ac 100644 --- a/bot.py +++ b/bot.py @@ -107,9 +107,9 @@ async def start(bot: Client, cmd: Message): else: #message_ids.append(int(GetMessage.id)) # for i in range(len(message_ids)): - await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) + #await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: - await cmd.reply_text('files will delete after few seconds') + # await cmd.reply_text('files will delete after few seconds') async def send_files(bot, chat_id, file_ids): for file_id in file_ids: From 39ca91f1982320afccd40713709da33304ae5887 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:19:27 +0530 Subject: [PATCH 60/88] Update bot.py --- bot.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bot.py b/bot.py index f6b89ac..f895f4d 100644 --- a/bot.py +++ b/bot.py @@ -111,16 +111,20 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') -async def send_files(bot, chat_id, file_ids): - for file_id in file_ids: - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_DOCUMENT) - bot.send_document(chat_id=chat_id, document=file_id) - # Wait for 30 seconds before deleting the file. - time.sleep(30) - - # Delete all files after the last file has been sent - for file_id in file_ids: - bot.delete_message(chat_id=chat_id, message_id=file_id) +# Send all files + files = reply_message.media + sent_messages = [] + for file in files: + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) + await cmd.reply_text('files will delete after few seconds') + + # Wait for 20 seconds + await asyncio.sleep(DELETE_TIME) + + # Delete all files + for sent_message in sent_messages: + await sent_message.delete() except: pass From 84c8cbe2918a4194fafb035995601633094d6fca Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:22:26 +0530 Subject: [PATCH 61/88] Update bot.py --- bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index f895f4d..f751735 100644 --- a/bot.py +++ b/bot.py @@ -104,13 +104,14 @@ async def start(bot: Client, cmd: Message): # quote=True, # disable_web_page_preview=True # ) - else: + # else: #message_ids.append(int(GetMessage.id)) # for i in range(len(message_ids)): #await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: # await cmd.reply_text('files will delete after few seconds') + else: # Send all files files = reply_message.media sent_messages = [] From 5434fc7ec17b9d9facea5ac1c06705d79e82f994 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:23:33 +0530 Subject: [PATCH 62/88] Update send_file.py --- handlers/send_file.py | 1 + 1 file changed, 1 insertion(+) diff --git a/handlers/send_file.py b/handlers/send_file.py index 81edc5a..810e341 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -41,6 +41,7 @@ async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) # await reply_forward(message=sent_message, file_id=file_id) time.sleep(1) + return sent_message #await sent_message.delete(delete_file(file_id=file_id)) # schedule the file deletion task #async def send_files(bot, user_id, file_ids): From c1db8d8fe344d67bcee2d2b98292073e74cf22c9 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:25:17 +0530 Subject: [PATCH 63/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index f751735..c08841c 100644 --- a/bot.py +++ b/bot.py @@ -111,7 +111,7 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') - else: +else: # Send all files files = reply_message.media sent_messages = [] From ba7904c983ba7877e806813e8c5c7dfcbe8101ff Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:30:43 +0530 Subject: [PATCH 64/88] Update bot.py --- bot.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bot.py b/bot.py index c08841c..ce113ce 100644 --- a/bot.py +++ b/bot.py @@ -111,21 +111,21 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') -else: + else: # Send all files - files = reply_message.media - sent_messages = [] - for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) - await cmd.reply_text('files will delete after few seconds') + files = reply_message.media + sent_messages = [] + for file in files: + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) + await cmd.reply_text('files will delete after few seconds') # Wait for 20 seconds - await asyncio.sleep(DELETE_TIME) + await asyncio.sleep(DELETE_TIME) # Delete all files - for sent_message in sent_messages: - await sent_message.delete() + for sent_message in sent_messages: + await sent_message.delete() except: pass From ced370120f4145433d939400936eff9e04661817 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:31:24 +0530 Subject: [PATCH 65/88] Update bot.py --- bot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bot.py b/bot.py index ce113ce..8a379fb 100644 --- a/bot.py +++ b/bot.py @@ -49,6 +49,7 @@ api_hash=Config.API_HASH ) +DELETE_TIME = 20 @Bot.on_message(filters.private) async def _(bot: Client, cmd: Message): From 03e415ff0cbfa937eec329ca554db98d28e30c98 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:35:24 +0530 Subject: [PATCH 66/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 8a379fb..6e06b69 100644 --- a/bot.py +++ b/bot.py @@ -112,7 +112,7 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') - else: + else: # Send all files files = reply_message.media sent_messages = [] From efc7cc61050c29ec76510d97f8fd760e19c78b7b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:37:05 +0530 Subject: [PATCH 67/88] Update bot.py --- bot.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot.py b/bot.py index 6e06b69..cfef110 100644 --- a/bot.py +++ b/bot.py @@ -112,14 +112,14 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') - else: + else: # Send all files - files = reply_message.media - sent_messages = [] - for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) - await cmd.reply_text('files will delete after few seconds') + files = reply_message.media + sent_messages = [] + for file in files: + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) + await cmd.reply_text('files will delete after few seconds') # Wait for 20 seconds await asyncio.sleep(DELETE_TIME) From b92622cf765efdc8ce8e41563ab3cf825fdb217a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:46:31 +0530 Subject: [PATCH 68/88] Update bot.py --- bot.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bot.py b/bot.py index cfef110..a0ad40c 100644 --- a/bot.py +++ b/bot.py @@ -112,21 +112,19 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') - else: -# Send all files - files = reply_message.media - sent_messages = [] - for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) - await cmd.reply_text('files will delete after few seconds') - + else: + files = reply_message.media + sent_messages = [] + for i in range(len(message_ids)): + for file in files: sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) + # Wait for 20 seconds - await asyncio.sleep(DELETE_TIME) + await asyncio.sleep(DELETE_TIME) # Delete all files - for sent_message in sent_messages: - await sent_message.delete() + for sent_message in sent_messages: + await sent_message.delete() except: pass From 85b80043f2c0f7ed606433f2ae977f14502e859b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:50:44 +0530 Subject: [PATCH 69/88] Update bot.py --- bot.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bot.py b/bot.py index a0ad40c..fed5c83 100644 --- a/bot.py +++ b/bot.py @@ -110,14 +110,14 @@ async def start(bot: Client, cmd: Message): # for i in range(len(message_ids)): #await send_media_and_reply(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) # except Exception as err: - # await cmd.reply_text('files will delete after few seconds') - - else: + # await cmd.reply_text('files will delete after few seconds') + else: files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) + for file in files: + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) # Wait for 20 seconds await asyncio.sleep(DELETE_TIME) @@ -128,10 +128,6 @@ async def start(bot: Client, cmd: Message): except: pass - - - - @Bot.on_message((filters.document | filters.video | filters.audio) & ~filters.chat(Config.DB_CHANNEL)) async def main(bot: Client, message: Message): From f4615a376f722f1d9d621dd508e00c87f405367b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:51:45 +0530 Subject: [PATCH 70/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index fed5c83..a3d472a 100644 --- a/bot.py +++ b/bot.py @@ -120,7 +120,7 @@ async def start(bot: Client, cmd: Message): sent_messages.append(sent_message) # Wait for 20 seconds - await asyncio.sleep(DELETE_TIME) + await asyncio.sleep(DELETE_TIME) # Delete all files for sent_message in sent_messages: From 7f795ff5003f70bdfb2d381d42befa570d8a3661 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:53:03 +0530 Subject: [PATCH 71/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a3d472a..e900664 100644 --- a/bot.py +++ b/bot.py @@ -115,7 +115,7 @@ async def start(bot: Client, cmd: Message): files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: + for file in files: sent_message = await message.reply_document(document=file) sent_messages.append(sent_message) From 54a7ac982bcdf91ac334a5602290f8515ff2fcc2 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:57:55 +0530 Subject: [PATCH 72/88] Update bot.py --- bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index e900664..f9798fe 100644 --- a/bot.py +++ b/bot.py @@ -116,15 +116,15 @@ async def start(bot: Client, cmd: Message): sent_messages = [] for i in range(len(message_ids)): for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) # Wait for 20 seconds - await asyncio.sleep(DELETE_TIME) + await asyncio.sleep(DELETE_TIME) # Delete all files - for sent_message in sent_messages: - await sent_message.delete() + for sent_message in sent_messages: + await sent_message.delete() except: pass From 08ac3215a83e437630a185f7649fd3db37a72e28 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:00:06 +0530 Subject: [PATCH 73/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index f9798fe..91ef899 100644 --- a/bot.py +++ b/bot.py @@ -115,7 +115,7 @@ async def start(bot: Client, cmd: Message): files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: + for file in files: sent_message = await message.reply_document(document=file) sent_messages.append(sent_message) From 4488c6a40e568c757cdf3b8d5eb20faa0fcb103d Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:01:20 +0530 Subject: [PATCH 74/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 91ef899..62f283e 100644 --- a/bot.py +++ b/bot.py @@ -115,7 +115,7 @@ async def start(bot: Client, cmd: Message): files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: + for file in files: sent_message = await message.reply_document(document=file) sent_messages.append(sent_message) From 03bd4eed48cd9433583ac4329a2214f91112c868 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:03:20 +0530 Subject: [PATCH 75/88] Update bot.py --- bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 62f283e..d7cceb1 100644 --- a/bot.py +++ b/bot.py @@ -112,12 +112,12 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') else: - files = reply_message.media + files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) + for file in files: + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) # Wait for 20 seconds await asyncio.sleep(DELETE_TIME) From 1e4ae0ccef69c929e07f4ba8c1055b10b73c644a Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:04:46 +0530 Subject: [PATCH 76/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index d7cceb1..3506e96 100644 --- a/bot.py +++ b/bot.py @@ -112,7 +112,7 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') else: - files = reply_message.media + files = reply_message.media sent_messages = [] for i in range(len(message_ids)): for file in files: From 766f38f617e51c5480a865238c9523e12c4212ed Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:07:00 +0530 Subject: [PATCH 77/88] Update bot.py --- bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 3506e96..4db98e8 100644 --- a/bot.py +++ b/bot.py @@ -113,11 +113,11 @@ async def start(bot: Client, cmd: Message): # await cmd.reply_text('files will delete after few seconds') else: files = reply_message.media - sent_messages = [] + sent_messages = [] for i in range(len(message_ids)): for file in files: - sent_message = await message.reply_document(document=file) - sent_messages.append(sent_message) + sent_message = await message.reply_document(document=file) + sent_messages.append(sent_message) # Wait for 20 seconds await asyncio.sleep(DELETE_TIME) From 663010e84a202c542ddc696177cccea7a9670e0b Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Mon, 1 May 2023 20:47:49 +0530 Subject: [PATCH 78/88] Rename send_file.py to Ntg.txt --- handlers/{send_file.py => Ntg.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename handlers/{send_file.py => Ntg.txt} (100%) diff --git a/handlers/send_file.py b/handlers/Ntg.txt similarity index 100% rename from handlers/send_file.py rename to handlers/Ntg.txt From bb8f04b3d475d7dc3b356dcf6e2ef9d486be6b7f Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Mon, 1 May 2023 20:49:32 +0530 Subject: [PATCH 79/88] Add files via upload --- handlers/send_file.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 handlers/send_file.py diff --git a/handlers/send_file.py b/handlers/send_file.py new file mode 100644 index 0000000..92988be --- /dev/null +++ b/handlers/send_file.py @@ -0,0 +1,40 @@ +#@MxA_Bots | @iSmartBoi_Ujjwal + +import asyncio +from configs import Config +from pyrogram import Client +from pyrogram.types import Message +from pyrogram.errors import FloodWait +from handlers.helpers import str_to_b64 + +async def reply_forward(message: Message, file_id: int): + try: + await message.reply_text( + f"**Files will be Deleted After 1 min**\n" + f"💡Forward it to saved massages or anywhere before downloading.😁\n" + f"😇Join @Movies_X_Animes", + disable_web_page_preview=True, quote=True) + except FloodWait as e: + await asyncio.sleep(e.value) + await reply_forward(message, file_id) + + +async def media_forward(bot: Client, user_id: int, file_id: int): + try: + if Config.FORWARD_AS_COPY is True: + return await bot.copy_message(chat_id=user_id, from_chat_id=Config.DB_CHANNEL, + message_id=file_id) + + elif Config.FORWARD_AS_COPY is False: + return await bot.forward_messages(chat_id=user_id, from_chat_id=Config.DB_CHANNEL, + message_ids=file_id) + except FloodWait as e: + await asyncio.sleep(e.value) + return media_forward(bot, user_id, file_id) + + +async def send_media_and_reply(bot: Client, user_id: int, file_id: int): + sent_message = await media_forward(bot, user_id, file_id) + await reply_forward(message=sent_message, file_id=file_id) + await asyncio.sleep(60) + await sent_message.delete() From 7fd42aec68b5e48ec0f4d861969e0a0918834dca Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Mon, 1 May 2023 20:50:32 +0530 Subject: [PATCH 80/88] Update send_file.py --- handlers/send_file.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 92988be..16fd2fb 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -35,6 +35,8 @@ async def media_forward(bot: Client, user_id: int, file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - await reply_forward(message=sent_message, file_id=file_id) + n = await reply_forward(message=sent_message, file_id=file_id) await asyncio.sleep(60) await sent_message.delete() + await asyncio.sleep(0.5) + await n.delete() From f6bef89a473ccd4bd90368f7a84c0d111fa2eeae Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 12:10:57 +0530 Subject: [PATCH 81/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 4db98e8..29cd3ef 100644 --- a/bot.py +++ b/bot.py @@ -116,7 +116,7 @@ async def start(bot: Client, cmd: Message): sent_messages = [] for i in range(len(message_ids)): for file in files: - sent_message = await message.reply_document(document=file) + sent_message = await message.reply_document(bot, user_id=cmd.from_user.id, document=file, file_id=int(message_ids[i])) sent_messages.append(sent_message) # Wait for 20 seconds From d2bc28fc60958b876651e471632ef96b51c46cbe Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 12:13:11 +0530 Subject: [PATCH 82/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 29cd3ef..7246737 100644 --- a/bot.py +++ b/bot.py @@ -115,7 +115,7 @@ async def start(bot: Client, cmd: Message): files = reply_message.media sent_messages = [] for i in range(len(message_ids)): - for file in files: + # for file in files: sent_message = await message.reply_document(bot, user_id=cmd.from_user.id, document=file, file_id=int(message_ids[i])) sent_messages.append(sent_message) From 300d5d5ea3267407a8665679e27317836c3a9250 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 12:23:52 +0530 Subject: [PATCH 83/88] Update send_file.py --- handlers/send_file.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 16fd2fb..35bebcb 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -35,8 +35,10 @@ async def media_forward(bot: Client, user_id: int, file_id: int): async def send_media_and_reply(bot: Client, user_id: int, file_id: int): sent_message = await media_forward(bot, user_id, file_id) - n = await reply_forward(message=sent_message, file_id=file_id) - await asyncio.sleep(60) - await sent_message.delete() - await asyncio.sleep(0.5) - await n.delete() + await asyncio.sleep(1) + return sent_message + # n = await reply_forward(message=sent_message, file_id=file_id) + # await asyncio.sleep(60) + # await sent_message.delete() + # await asyncio.sleep(0.5) + # await n.delete() From ce42d91afd3e3f8cc9eecd1be06fb44ca7c82531 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 13:01:52 +0530 Subject: [PATCH 84/88] Update bot.py --- bot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bot.py b/bot.py index 7246737..a633e67 100644 --- a/bot.py +++ b/bot.py @@ -112,6 +112,7 @@ async def start(bot: Client, cmd: Message): # except Exception as err: # await cmd.reply_text('files will delete after few seconds') else: + message_ids.append(int(GetMessage.id)) files = reply_message.media sent_messages = [] for i in range(len(message_ids)): From ec147efbacb77dea505a9b25ebbd6def985a1a07 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 13:11:02 +0530 Subject: [PATCH 85/88] Update send_file.py --- handlers/send_file.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/handlers/send_file.py b/handlers/send_file.py index 35bebcb..4310c96 100644 --- a/handlers/send_file.py +++ b/handlers/send_file.py @@ -33,12 +33,31 @@ async def media_forward(bot: Client, user_id: int, file_id: int): return media_forward(bot, user_id, file_id) -async def send_media_and_reply(bot: Client, user_id: int, file_id: int): - sent_message = await media_forward(bot, user_id, file_id) - await asyncio.sleep(1) - return sent_message +# async def send_media_and_reply(bot: Client, user_id: int, file_id: int): + # sent_message = await media_forward(bot, user_id, file_id) + # await asyncio.sleep(1) + # return sent_message # n = await reply_forward(message=sent_message, file_id=file_id) # await asyncio.sleep(60) # await sent_message.delete() # await asyncio.sleep(0.5) # await n.delete() + + +async def send_media(bot: Client, user_id: int, file_id: int): + new_message = await media_forward(bot, user_id, file_id) + await asyncio.sleep(1) + return new_message + + + + + + + + + + + + + From 63ed894587e618b3d6e1b26d1098b5ce40607833 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 13:15:21 +0530 Subject: [PATCH 86/88] Update bot.py --- bot.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bot.py b/bot.py index a633e67..a923d46 100644 --- a/bot.py +++ b/bot.py @@ -117,15 +117,11 @@ async def start(bot: Client, cmd: Message): sent_messages = [] for i in range(len(message_ids)): # for file in files: - sent_message = await message.reply_document(bot, user_id=cmd.from_user.id, document=file, file_id=int(message_ids[i])) - sent_messages.append(sent_message) - - # Wait for 20 seconds - await asyncio.sleep(DELETE_TIME) - - # Delete all files - for sent_message in sent_messages: - await sent_message.delete() + sent_message = await message.send_media(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) + sent_messages.append(sent_message) # for batch files + await asyncio.sleep(DELETE_TIME) # Wait for 20 seconds + for sent_message in sent_messages: + await sent_message.delete() # Delete all files except: pass From 2b782912fc20b5020fe957d8273d2a22a7bef690 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 13:16:52 +0530 Subject: [PATCH 87/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a923d46..77fb707 100644 --- a/bot.py +++ b/bot.py @@ -26,7 +26,7 @@ from configs import Config from handlers.database import db from handlers.add_user_to_db import add_user_to_database -from handlers.send_file import send_media_and_reply +from handlers.send_file import send_media from handlers.helpers import b64_to_str, str_to_b64 from handlers.check_user_status import handle_user_status from handlers.force_sub_handler import ( From a1e865bb304052f78f78d6a90c2b8b78181c7e61 Mon Sep 17 00:00:00 2001 From: Ujjwalm2004 <130154620+Ujjwalm2004@users.noreply.github.com> Date: Tue, 2 May 2023 13:20:44 +0530 Subject: [PATCH 88/88] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 77fb707..f1f48bb 100644 --- a/bot.py +++ b/bot.py @@ -119,7 +119,7 @@ async def start(bot: Client, cmd: Message): # for file in files: sent_message = await message.send_media(bot, user_id=cmd.from_user.id, file_id=int(message_ids[i])) sent_messages.append(sent_message) # for batch files - await asyncio.sleep(DELETE_TIME) # Wait for 20 seconds + await asyncio.sleep(DELETE_TIME) # Wait for 20 seconds for sent_message in sent_messages: await sent_message.delete() # Delete all files except: