diff --git a/Readme.md b/README.md similarity index 80% rename from Readme.md rename to README.md index f8392e3c5..9d908da40 100644 --- a/Readme.md +++ b/README.md @@ -1,18 +1,18 @@ # Adv Auto Filter Bot V2

- - + + - - + +

-__This Is Just An Simple Advance Auto Filter Bot Complete Rewritten Version Of [Adv-Filter-Bot](https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot)..__ +__This Is Just An Simple Advance Auto Filter Bot Complete Rewritten Version Of [Adv-Filter-Bot](https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot)..__ __Just Sent Any Text As Query It Will Search For All Connected Chat's Files In Its MongoDB And Reply You With The Message Link As A Button__ @@ -73,7 +73,7 @@ You can deploy this bot anywhere.
Deploy To Heroku


- + Deploy

@@ -82,8 +82,8 @@ You can deploy this bot anywhere.
Deploy To VPS

-git clone https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/tree/blob/main
-cd Adv-Auto-Filter-Bot-ReMaster
+git clone https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2
+cd Adv-Auto-Filter-Bot-V2
 pip3 install -r requirements.txt
 # Change The Vars Of bot/__init__.py File Accordingly
 python3 -m bot
@@ -99,7 +99,7 @@ Do Fork And Star The Repository If You Liked It.
 
 ## Disclaimer
 [![GNU Affero General Public License v3.0](https://www.gnu.org/graphics/agplv3-155x51.png)](https://www.gnu.org/licenses/agpl-3.0.en.html#header)    
-Licensed under [GNU AGPL v3.0.](https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/blob/main/LICENSE)
+Licensed under [GNU AGPL v3.0.](https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2/blob/main/LICENSE)
 Selling The Codes To Other People For Money Is *Strictly Prohibited*.
 
 
@@ -107,3 +107,4 @@ Selling The Codes To Other People For Money Is *Strictly Prohibited*.
 
  - Thanks To Dan For His Awsome [Libary](https://github.com/pyrogram/pyrogram)
  - Thanks To SpEcHiDe For His Awesome [DeleteMessagesRoBot](https://github.com/SpEcHiDe/DeleteMessagesRoBot)
+ - [Thanks To Me ๐Ÿ‘€](https://github.com/AlbertEinsteinTG)
diff --git a/app.json b/app.json
index 70fdbee45..edf862935 100644
--- a/app.json
+++ b/app.json
@@ -7,8 +7,8 @@
         "Filter",
         "Mongo DB"
     ],
-    "website": "https://github.com/AlbertEinsteinTG",
-    "repository": "https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2",
+    "website": "https://github.com/CrazyBotsz",
+    "repository": "https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2",
     "success_url": "https://telegram.dog/CrazyBotsz",
     "env": {
         "APP_ID": {
diff --git a/bot/bot.py b/bot/bot.py
index e90f1f018..abb8fc487 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 # (c) @SpEcHIDe
 
-from pyrogram import Client, __version__
+from pyrogram import Client, enums, __version__
 
 from . import API_HASH, APP_ID, LOGGER, BOT_TOKEN 
 
@@ -20,7 +20,7 @@ def __init__(self):
             plugins={
                 "root": "bot/plugins"
             },
-            workers=4,
+            workers=200,
             bot_token=BOT_TOKEN,
             sleep_threshold=10
         )
@@ -29,7 +29,7 @@ def __init__(self):
     async def start(self):
         await super().start()
         bot_details = await self.get_me()
-        self.set_parse_mode("html")
+        self.set_parse_mode(enums.ParseMode.HTML)
         self.LOGGER(__name__).info(
             f"@{bot_details.username}  started! "
         )
diff --git a/bot/database/database.py b/bot/database/database.py
index 4e9701548..2c345a9b7 100644
--- a/bot/database/database.py
+++ b/bot/database/database.py
@@ -1,21 +1,14 @@
+import os
 import motor.motor_asyncio # pylint: disable=import-error
 from bot import DB_URI
 
-class Singleton(type):
-    __instances__ = {}
+DB_NAME = os.environ.get("DB_NAME", "Adv_Auto_Filter")
 
-    def __call__(cls, *args, **kwargs):
-        if cls not in cls.__instances__:
-            cls.__instances__[cls] = super(Singleton, cls).__call__(*args, **kwargs)
-
-        return cls.__instances__[cls]
-
-
-class Database(metaclass=Singleton):
+class Database:
 
     def __init__(self):
         self._client = motor.motor_asyncio.AsyncIOMotorClient(DB_URI)
-        self.db = self._client["Adv_Auto_Filter"]
+        self.db = self._client[DB_NAME]
         self.col = self.db["Main"]
         self.acol = self.db["Active_Chats"]
         self.fcol = self.db["Filter_Collection"]
@@ -165,9 +158,7 @@ async def del_chat(self, group_id: int, channel_id: int):
                                 channel_id
                             }
                         }
-                    },
-                False,
-                True
+                    }
             )
 
             await self.del_active(group_id, channel_id)
@@ -302,7 +293,7 @@ async def del_active(self, group_id: int, channel_id: int):
         templ = {"$pull": {"chats": dict(chat_id = channel_id)}}
         
         try:
-            await self.acol.update_one({"_id": group_id}, templ, False, True)
+            await self.acol.update_one({"_id": group_id}, templ)
         except Exception as e:
             print(e)
             pass
diff --git a/bot/plugins/auto_filter.py b/bot/plugins/auto_filter.py
index 76d06ef6d..660235dff 100644
--- a/bot/plugins/auto_filter.py
+++ b/bot/plugins/auto_filter.py
@@ -2,7 +2,7 @@
 import logging
 import asyncio
 
-from pyrogram import Client, filters
+from pyrogram import Client, filters, enums
 from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
 from pyrogram.errors import ButtonDataInvalid, FloodWait
 
@@ -15,7 +15,7 @@
 ACTIVE_CHATS = {}
 db = Database()
 
-@Bot.on_message(filters.text & filters.group & ~filters.bot, group=0)
+@Bot.on_message(filters.text & filters.group, group=0)
 async def auto_filter(bot, update):
     """
     A Funtion To Handle Incoming Text And Reply With Appropriate Results
@@ -112,7 +112,7 @@ async def auto_filter(bot, update):
                         bot_= await bot.get_me()
                         FIND["bot_details"] = bot_
                     except FloodWait as e:
-                        asyncio.sleep(e.x)
+                        await asyncio.sleep(e.value)
                         bot_= await bot.get_me()
                         FIND["bot_details"] = bot_
                 
@@ -205,8 +205,8 @@ async def auto_filter(bot, update):
                 chat_id = update.chat.id,
                 text=f"Found {(len_results)} Results For Your Query: {query}",
                 reply_markup=reply_markup,
-                parse_mode="html",
-                reply_to_message_id=update.message_id
+                parse_mode=enums.ParseMode.HTML,
+                reply_to_message_id=update.id
             )
 
         except ButtonDataInvalid:
diff --git a/bot/plugins/callback.py b/bot/plugins/callback.py
index eefa58d00..e50aaf759 100644
--- a/bot/plugins/callback.py
+++ b/bot/plugins/callback.py
@@ -2,7 +2,7 @@
 import time
 import asyncio
 
-from pyrogram import Client, filters
+from pyrogram import Client, filters, enums
 from pyrogram.errors import FloodWait, UserNotParticipant
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
 
@@ -44,7 +44,7 @@ async def cb_navg(bot, update: CallbackQuery):
         
         admin_list = []
         
-        async for x in bot.iter_chat_members(chat_id=chat_id, filter="administrators"):
+        async for x in bot.get_chat_members(chat_id=chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
             admin_id = x.user.id 
             admin_list.append(admin_id)
             
@@ -148,15 +148,15 @@ async def cb_navg(bot, update: CallbackQuery):
         await update.message.edit(
                 text,
                 reply_markup=reply_markup,
-                parse_mode="html"
+                parse_mode=enums.ParseMode.HTML
         )
         
     except FloodWait as f: # Flood Wait Caused By Spamming Next/Back Buttons
-        await asyncio.sleep(f.x)
+        await asyncio.sleep(f.value)
         await update.message.edit(
                 text,
                 reply_markup=reply_markup,
-                parse_mode="html"
+                parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -221,7 +221,7 @@ async def cb_settings(bot, update: CallbackQuery):
     await update.message.edit_text(
         text, 
         reply_markup=reply_markup, 
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -281,7 +281,7 @@ async def cb_warn(bot, update: CallbackQuery):
     await update.message.edit_text(
         text,
         reply_markup=reply_markup,
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -382,7 +382,7 @@ async def cb_channel_list(bot, update: CallbackQuery):
     await update.message.edit_text(
             text = text,
             reply_markup=reply_markup,
-            parse_mode="html"
+            parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -480,7 +480,7 @@ async def cb_info(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
         
     await update.message.edit_text(
-            text, reply_markup=reply_markup, parse_mode="html"
+            text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -554,7 +554,7 @@ async def cb_connect(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
         
     await update.message.edit_text(
-            text, reply_markup=reply_markup, parse_mode="html"
+            text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -627,7 +627,7 @@ async def cb_disconnect(bot, update: CallbackQuery):
     await recacher(chat_id, False, True, bot, update)
 
     await update.message.edit_text(
-            text, reply_markup=reply_markup, parse_mode="html"
+            text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
         )
 
 
@@ -679,7 +679,7 @@ async def cb_channel_delete(bot, update: CallbackQuery):
     reply_markup=InlineKeyboardMarkup(buttons)
 
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -725,7 +725,7 @@ async def cb_filters_delete(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
 
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
     
 
@@ -809,7 +809,7 @@ async def cb_types(bot, update: CallbackQuery):
     await update.message.edit_text(
         text,
         reply_markup=reply_markup, 
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -923,7 +923,7 @@ async def cb_toggle(bot, update: CallbackQuery):
     await update.message.edit_text(
         text,
         reply_markup=reply_markup, 
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1037,7 +1037,7 @@ async def cb_config(bot, update: CallbackQuery):
     await update.message.edit_text(
         text, 
         reply_markup=reply_markup, 
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1108,7 +1108,7 @@ async def cb_max_buttons(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
 
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1175,7 +1175,7 @@ async def cb_max_page(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
     
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1247,7 +1247,7 @@ async def cb_max_results(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
 
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1308,7 +1308,7 @@ async def cb_show_invites(bot, update: CallbackQuery):
     await update.message.edit_text(
         text,
         reply_markup=reply_markup,
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1369,7 +1369,7 @@ async def cb_pm_file(bot, update: CallbackQuery):
     await update.message.edit_text(
         text,
         reply_markup=reply_markup,
-        parse_mode="html"
+        parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1444,7 +1444,7 @@ async def cb_accuracy(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
 
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1536,7 +1536,7 @@ async def cb_set(bot, update: CallbackQuery):
     reply_markup=InlineKeyboardMarkup(buttons)
     
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1581,7 +1581,7 @@ async def cb_status(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
     
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1602,7 +1602,7 @@ async def cb_about(bot, update: CallbackQuery):
     text+=f"\nBot's Uptime: {time_formatter(time.time() - start_uptime)}\n"
     text+=f"\nBot Funtion: Auto Filter Files\n"
     text+=f"""\nBot Support: @CrazyBotszGrp\n"""
-    text+="""\nSource Code: Source"""
+    text+="""\nSource Code: Source"""
 
     buttons = [
         [
@@ -1627,7 +1627,7 @@ async def cb_about(bot, update: CallbackQuery):
     reply_markup = InlineKeyboardMarkup(buttons)
     
     await update.message.edit_text(
-        text, reply_markup=reply_markup, parse_mode="html"
+        text, reply_markup=reply_markup, parse_mode=enums.ParseMode.HTML
     )
 
 
@@ -1640,7 +1640,7 @@ async def callback_data(bot, update: CallbackQuery):
     if query_data == "start":
         buttons = [[
             InlineKeyboardButton('My Dev ๐Ÿ‘จโ€๐Ÿ”ฌ', url='https://t.me/AlbertEinstein_TG'),
-            InlineKeyboardButton('Source Code ๐Ÿงพ', url ='https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot')
+            InlineKeyboardButton('Source Code ๐Ÿงพ', url ='https://github.com/CrazyBotsz/Adv-Filter-Bot-V2')
         ],[
             InlineKeyboardButton('Support ๐Ÿ› ', url='https://t.me/CrazyBotszGrp')
         ],[
@@ -1652,7 +1652,7 @@ async def callback_data(bot, update: CallbackQuery):
         await update.message.edit_text(
             Translation.START_TEXT.format(update.from_user.mention),
             reply_markup=reply_markup,
-            parse_mode="html",
+            parse_mode=enums.ParseMode.HTML,
             disable_web_page_preview=True
         )
 
@@ -1670,7 +1670,7 @@ async def callback_data(bot, update: CallbackQuery):
         await update.message.edit_text(
             Translation.HELP_TEXT,
             reply_markup=reply_markup,
-            parse_mode="html",
+            parse_mode=enums.ParseMode.HTML,
             disable_web_page_preview=True
         )
 
@@ -1686,7 +1686,7 @@ async def callback_data(bot, update: CallbackQuery):
         await update.message.edit_text(
             Translation.ABOUT_TEXT,
             reply_markup=reply_markup,
-            parse_mode="html"
+            parse_mode=enums.ParseMode.HTML
         )
 
 
diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py
index cc8478c6e..1be067835 100644
--- a/bot/plugins/channel.py
+++ b/bot/plugins/channel.py
@@ -2,15 +2,16 @@
 import string
 import asyncio
 
-from pyrogram import Client, filters
+from pyrogram import Client, filters, enums
 from pyrogram.errors import UserAlreadyParticipant, FloodWait
 
-from bot import VERIFY # pylint: disable=import-error
+from bot import VERIFY, LOGGER # pylint: disable=import-error
 from bot.bot import Bot # pylint: disable=import-error
 from bot.database import Database # pylint: disable=import-error
 from bot.plugins.auto_filter import recacher # pylint: disable=import-error
 
 db = Database()
+logger = LOGGER(__name__)
 
 @Client.on_message(filters.command(["add"]) & filters.group, group=1)
 async def connect(bot: Bot, update):
@@ -24,7 +25,7 @@ async def connect(bot: Bot, update):
     
     if VERIFY.get(str(chat_id)) == None: # Make Admin's ID List
         admin_list = []
-        async for x in bot.iter_chat_members(chat_id=chat_id, filter="administrators"):
+        async for x in bot.get_chat_members(chat_id=chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
             admin_id = x.user.id 
             admin_list.append(admin_id)
         admin_list.append(None)
@@ -50,25 +51,26 @@ async def connect(bot: Bot, update):
         await update.reply_text("Invalid Input...\nYou Should Specify Valid chat_id(-100xxxxxxxxxx) or @username")
         return
     
+    # Exports invite link from target channel for user to join
     try:
         join_link = await bot.export_chat_invite_link(target)
+        join_link = join_link.replace('+', 'joinchat/')
     except Exception as e:
-        print(e)
-        await update.reply_text(f"Make Sure Im Admin At {target} And Have Permission For 'Inviting Users via Link' And Try Again.....!!!")
+        logger.exception(e, exc_info=True)
+        await update.reply_text(f"Make Sure Im Admin At {target} And Have Permission For Inviting Users via Link And Try Again.....!!!\n\nError Logged: {e}", parse_mode='html')
         return
     
     userbot_info = await bot.USER.get_me()
-    userbot_id = userbot_info.id
-    userbot_name = userbot_info.first_name
     
+    # Joins to targeted chat using above exported invite link
+    # If aldready joined, code just pass on to next code
     try:
         await bot.USER.join_chat(join_link)
-        
     except UserAlreadyParticipant:
         pass
-    
-    except Exception:
-        await update.reply_text(f"My UserBot [{userbot_name}](tg://user?id={userbot_id}) Couldnt Join The Channel `{target}` Make Sure Userbot Is Not Banned There Or Add It Manually And Try Again....!!")
+    except Exception as e:
+        logger.exception(e, exc_info=True)
+        await update.reply_text(f"{userbot_info.mention} Couldnt Join The Channel {target} Make Sure Userbot Is Not Banned There Or Add It Manually And Try Again....!!\n\nError Logged: {e}", parse_mode='html')
         return
     
     try:
@@ -90,26 +92,28 @@ async def connect(bot: Bot, update):
     wait_msg = await update.reply_text("Please Wait Till I Add All Your Files From Channel To Db\n\nThis May Take 10 or 15 Mins Depending On Your No. Of Files In Channel.....\n\nUntil Then Please Dont Sent Any Other Command Or This Operation May Be Intrupted....")
     
     try:
-        type_list = ["video", "audio", "document"]
+        mf = enums.MessagesFilter
+        type_list = [mf.VIDEO, mf.DOCUMENT, mf.AUDIO]
         data = []
         skipCT = 0
         
         for typ in type_list:
 
-            async for msgs in bot.USER.search_messages(channel_id,filter=typ): #Thanks To @PrgOfficial For Suggesting
+            async for msgs in bot.USER.search_messages(channel_id, filter=typ): #Thanks To @PrgOfficial For Suggesting
                 
                 # Using 'if elif' instead of 'or' to determine 'file_type'
                 # Better Way? Make A PR
                 try:
+                    try:
+                        file_id = await bot.get_messages(channel_id, message_ids=msgs.id)
+                    except FloodWait as e:
+                        await asyncio.sleep(e.value)
+                        file_id = await bot.get_messages(channel_id, message_ids=msgs.id)
+                    except Exception as e:
+                        print(e)
+                        continue
+
                     if msgs.video:
-                        try:
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except FloodWait as e:
-                            asyncio.sleep(e.x)
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except Exception as e:
-                            print(e)
-                            continue
                         file_id = file_id.video.file_id
                         file_name = msgs.video.file_name[0:-4]
                         file_caption  = msgs.caption if msgs.caption else ""
@@ -117,14 +121,6 @@ async def connect(bot: Bot, update):
                         file_type = "video"
                     
                     elif msgs.audio:
-                        try:
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except FloodWait as e:
-                            asyncio.sleep(e.x)
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except Exception as e:
-                            print(e)
-                            continue
                         file_id = file_id.audio.file_id
                         file_name = msgs.audio.file_name[0:-4]
                         file_caption  = msgs.caption if msgs.caption else ""
@@ -132,20 +128,15 @@ async def connect(bot: Bot, update):
                         file_type = "audio"
                     
                     elif msgs.document:
-                        try:
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except FloodWait as e:
-                            asyncio.sleep(e.x)
-                            file_id = await bot.get_messages(channel_id, message_ids=msgs.message_id)
-                        except Exception as e:
-                            print(str(e))
-                            continue
                         file_id = file_id.document.file_id
                         file_name = msgs.document.file_name[0:-4]
                         file_caption  = msgs.caption if msgs.caption else ""
                         file_size = msgs.document.file_size
                         file_type = "document"
                     
+                    else:
+                        return
+                    
                     for i in ["_", "|", "-", "."]: # Work Around
                         try:
                             file_name = file_name.replace(i, " ")
@@ -205,7 +196,7 @@ async def disconnect(bot: Bot, update):
     
     if VERIFY.get(str(chat_id)) == None: # Make Admin's ID List
         admin_list = []
-        async for x in bot.iter_chat_members(chat_id=chat_id, filter="administrators"):
+        async for x in bot.get_chat_members(chat_id=chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
             admin_id = x.user.id 
             admin_list.append(admin_id)
         admin_list.append(None)
@@ -269,7 +260,7 @@ async def delall(bot: Bot, update):
     
     if VERIFY.get(str(chat_id)) == None: # Make Admin's ID List
         admin_list = []
-        async for x in bot.iter_chat_members(chat_id=chat_id, filter="administrators"):
+        async for x in bot.get_chat_members(chat_id=chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
             admin_id = x.user.id 
             admin_list.append(admin_id)
         admin_list.append(None)
@@ -284,7 +275,7 @@ async def delall(bot: Bot, update):
     await update.reply_text("Sucessfully Deleted All Connected Chats From This Group....")
 
 
-@Client.on_message(filters.channel & (filters.video | filters.audio | filters.document) & ~filters.edited, group=0)
+@Client.on_message(filters.channel & (filters.video | filters.audio | filters.document), group=0)
 async def new_files(bot: Bot, update):
     """
     A Funtion To Handle Incoming New Files In A Channel ANd Add Them To Respective Channels..
diff --git a/bot/plugins/commands.py b/bot/plugins/commands.py
index 7af5d5db0..7e6fb7acf 100644
--- a/bot/plugins/commands.py
+++ b/bot/plugins/commands.py
@@ -2,9 +2,9 @@
 # -*- coding: utf-8 -*-
 # (c) @AlbertEinsteinTG
 
-from pyrogram import filters, Client
+from pyrogram import filters, Client, enums
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
-from bot import Translation # pylint: disable=import-error
+from bot import Translation, LOGGER # pylint: disable=import-error
 from bot.database import Database # pylint: disable=import-error
 
 db = Database()
@@ -24,34 +24,12 @@ async def start(bot, update):
             return
         
         caption = file_caption if file_caption != ("" or None) else ("" + file_name + "")
-        
-        if file_type == "document":
-        
-            await bot.send_document(
-                chat_id=update.chat.id,
-                document = file_id,
-                caption = caption,
-                parse_mode="html",
-                reply_to_message_id=update.message_id,
-                reply_markup=InlineKeyboardMarkup(
-                    [
-                        [
-                            InlineKeyboardButton
-                                (
-                                    'Developers', url="https://t.me/CrazyBotsz"
-                                )
-                        ]
-                    ]
-                )
-            )
-
-        elif file_type == "video":
-        
-            await bot.send_video(
-                chat_id=update.chat.id,
-                video = file_id,
+        try:
+            await update.reply_cached_media(
+                file_id,
+                quote=True,
                 caption = caption,
-                parse_mode="html",
+                parse_mode=enums.ParseMode.HTML,
                 reply_markup=InlineKeyboardMarkup(
                     [
                         [
@@ -63,34 +41,14 @@ async def start(bot, update):
                     ]
                 )
             )
-            
-        elif file_type == "audio":
-        
-            await bot.send_audio(
-                chat_id=update.chat.id,
-                audio = file_id,
-                caption = caption,
-                parse_mode="html",
-                reply_markup=InlineKeyboardMarkup(
-                    [
-                        [
-                            InlineKeyboardButton
-                                (
-                                    'Developers', url="https://t.me/CrazyBotsz"
-                                )
-                        ]
-                    ]
-                )
-            )
-
-        else:
-            print(file_type)
-        
+        except Exception as e:
+            await update.reply_text(f"Error:\n{e}", True, parse_mode=enums.ParseMode.HTML)
+            LOGGER(__name__).error(e)
         return
 
     buttons = [[
         InlineKeyboardButton('Developers', url='https://t.me/CrazyBotsz'),
-        InlineKeyboardButton('Source Code ๐Ÿงพ', url ='https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2')
+        InlineKeyboardButton('Source Code ๐Ÿงพ', url ='https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2')
     ],[
         InlineKeyboardButton('Support ๐Ÿ› ', url='https://t.me/CrazyBotszGrp')
     ],[
@@ -104,8 +62,8 @@ async def start(bot, update):
         text=Translation.START_TEXT.format(
                 update.from_user.first_name),
         reply_markup=reply_markup,
-        parse_mode="html",
-        reply_to_message_id=update.message_id
+        parse_mode=enums.ParseMode.HTML,
+        reply_to_message_id=update.id
     )
 
 
@@ -124,8 +82,8 @@ async def help(bot, update):
         chat_id=update.chat.id,
         text=Translation.HELP_TEXT,
         reply_markup=reply_markup,
-        parse_mode="html",
-        reply_to_message_id=update.message_id
+        parse_mode=enums.ParseMode.HTML,
+        reply_to_message_id=update.id
     )
 
 
@@ -143,6 +101,6 @@ async def about(bot, update):
         text=Translation.ABOUT_TEXT,
         reply_markup=reply_markup,
         disable_web_page_preview=True,
-        parse_mode="html",
-        reply_to_message_id=update.message_id
+        parse_mode=enums.ParseMode.HTML,
+        reply_to_message_id=update.id
     )
diff --git a/bot/plugins/settings.py b/bot/plugins/settings.py
index a8fd1c5fa..b42cc20a0 100644
--- a/bot/plugins/settings.py
+++ b/bot/plugins/settings.py
@@ -3,7 +3,7 @@
 # (c) @AlbertEinsteinTG
 
 import re
-from pyrogram import Client, filters
+from pyrogram import Client, filters, enums
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 
 from bot import VERIFY # pylint: disable=import-error
@@ -17,7 +17,7 @@ async def settings(bot, update):
 
     if VERIFY.get(str(chat_id)) == None: # Make Admin's ID List
         admin_list = []
-        async for x in bot.iter_chat_members(chat_id=chat_id, filter="administrators"):
+        async for x in bot.get_chat_members(chat_id=chat_id, filter=enums.ChatMembersFilter.ADMINISTRATORS):
             admin_id = x.user.id 
             admin_list.append(admin_id)
         admin_list.append(None)
@@ -76,8 +76,8 @@ async def settings(bot, update):
         chat_id=chat_id, 
         text=text, 
         reply_markup=reply_markup, 
-        parse_mode="html",
-        reply_to_message_id=update.message_id
+        parse_mode=enums.ParseMode.HTML,
+        reply_to_message_id=update.id
         
         )
 
diff --git a/bot/user.py b/bot/user.py
index 6962cc876..97b427ebe 100644
--- a/bot/user.py
+++ b/bot/user.py
@@ -11,15 +11,18 @@
 class User(Client):
     def __init__(self):
         super().__init__(
-            USER_SESSION,
+            "userbot",
             api_hash=API_HASH,
             api_id=APP_ID,
-            workers=4
+            session_string=USER_SESSION,
+            workers=20
         )
         self.LOGGER = LOGGER
 
     async def start(self):
         await super().start()
+        try: await self.export_session_string()
+        except: pass
         usr_bot_me = await self.get_me()
         return (self, usr_bot_me.id)