diff --git a/bot/database/database.py b/bot/database/database.py
index 8241abfa8..4e9701548 100644
--- a/bot/database/database.py
+++ b/bot/database/database.py
@@ -446,7 +446,7 @@ async def get_filters(self, group_id: int, keyword: str):
filters = []
pipeline= {
- '$text':{'$search': keyword}
+ 'group_id': int(group_id), '$text':{'$search': keyword}
}
@@ -477,12 +477,14 @@ async def get_file(self, unique_id: str):
file = await self.fcol.find_one({"unique_id": unique_id})
file_id = None
file_type = None
+ file_name = None
+ file_caption = None
if file:
file_id = file.get("file_id")
file_name = file.get("file_name")
file_type = file.get("file_type")
- file_caption = file.get("caption")
+ file_caption = file.get("file_caption")
return file_id, file_name, file_caption, file_type
diff --git a/bot/plugins/auto_filter.py b/bot/plugins/auto_filter.py
index c5248420e..76d06ef6d 100644
--- a/bot/plugins/auto_filter.py
+++ b/bot/plugins/auto_filter.py
@@ -15,7 +15,7 @@
ACTIVE_CHATS = {}
db = Database()
-@Bot.on_message(filters.text & filters.group, group=0)
+@Bot.on_message(filters.text & filters.group & ~filters.bot, group=0)
async def auto_filter(bot, update):
"""
A Funtion To Handle Incoming Text And Reply With Appropriate Results
@@ -64,7 +64,26 @@ async def auto_filter(bot, update):
file_name = filter.get("file_name")
file_type = filter.get("file_type")
file_link = filter.get("file_link")
+ file_size = int(filter.get("file_size", "0"))
+ # from B to MiB
+
+ if file_size < 1024:
+ file_size = f"[{file_size} B]"
+ elif file_size < (1024**2):
+ file_size = f"[{str(round(file_size/1024, 2))} KiB] "
+ elif file_size < (1024**3):
+ file_size = f"[{str(round(file_size/(1024**2), 2))} MiB] "
+ elif file_size < (1024**4):
+ file_size = f"[{str(round(file_size/(1024**3), 2))} GiB] "
+
+
+ file_size = "" if file_size == ("[0 B]") else file_size
+
+ # add emoji down below inside " " if you want..
+ button_text = f"{file_size}{file_name}"
+
+
if file_type == "video":
if allow_video:
pass
@@ -102,7 +121,7 @@ async def auto_filter(bot, update):
results.append(
[
- InlineKeyboardButton(file_name, url=file_link)
+ InlineKeyboardButton(button_text, url=file_link)
]
)
diff --git a/bot/plugins/callback.py b/bot/plugins/callback.py
index 3276f681e..eefa58d00 100644
--- a/bot/plugins/callback.py
+++ b/bot/plugins/callback.py
@@ -952,7 +952,7 @@ async def cb_config(bot, update: CallbackQuery):
mf_count = settings["configs"]["max_results"]
mr_count = settings["configs"]["max_per_page"]
show_invite = settings["configs"]["show_invite_link"]
- pm_file_chat = settings["configs"]["pm_fchat"]
+ pm_file_chat = settings["configs"].get("pm_fchat", False)
accuracy_point = settings["configs"].get("accuracy", 0.80)
text=f"Configure Your {chat_name} Group's Filter Settings...\n"
diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py
index 2ea646b89..cc8478c6e 100644
--- a/bot/plugins/channel.py
+++ b/bot/plugins/channel.py
@@ -113,6 +113,7 @@ async def connect(bot: Bot, update):
file_id = file_id.video.file_id
file_name = msgs.video.file_name[0:-4]
file_caption = msgs.caption if msgs.caption else ""
+ file_size = msgs.video.file_size
file_type = "video"
elif msgs.audio:
@@ -127,6 +128,7 @@ async def connect(bot: Bot, update):
file_id = file_id.audio.file_id
file_name = msgs.audio.file_name[0:-4]
file_caption = msgs.caption if msgs.caption else ""
+ file_size = msgs.audio.file_size
file_type = "audio"
elif msgs.document:
@@ -141,6 +143,7 @@ async def connect(bot: Bot, update):
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"
for i in ["_", "|", "-", "."]: # Work Around
@@ -164,6 +167,7 @@ async def connect(bot: Bot, update):
unique_id=unique_id,
file_name=file_name,
file_caption=file_caption,
+ file_size=file_size,
file_type=file_type,
file_link=file_link,
chat_id=channel_id,
@@ -280,7 +284,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), group=0)
+@Client.on_message(filters.channel & (filters.video | filters.audio | filters.document) & ~filters.edited, 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..
@@ -296,19 +300,22 @@ async def new_files(bot: Bot, update):
file_id = update.video.file_id
file_name = update.video.file_name[0:-4]
file_caption = update.caption if update.caption else ""
+ file_size = update.video.file_size
elif update.audio:
file_type = "audio"
file_id = update.audio.file_id
file_name = update.audio.file_name[0:-4]
file_caption = update.caption if update.caption else ""
+ file_size = update.audio.file_size
elif update.document:
file_type = "document"
file_id = update.document.file_id
file_name = update.document.file_name[0:-4]
file_caption = update.caption if update.caption else ""
-
+ file_size = update.document.file_size
+
for i in ["_", "|", "-", "."]: # Work Around
try:
file_name = file_name.replace(i, " ")
@@ -338,6 +345,7 @@ async def new_files(bot: Bot, update):
unique_id=unique_id,
file_name=file_name,
file_caption=file_caption,
+ file_size = file_size,
file_type=file_type,
file_link=file_link,
chat_id=channel_id,
diff --git a/bot/plugins/commands.py b/bot/plugins/commands.py
index 363c690ed..7af5d5db0 100644
--- a/bot/plugins/commands.py
+++ b/bot/plugins/commands.py
@@ -47,7 +47,7 @@ async def start(bot, update):
elif file_type == "video":
- await update.bot.send_video(
+ await bot.send_video(
chat_id=update.chat.id,
video = file_id,
caption = caption,
@@ -66,7 +66,7 @@ async def start(bot, update):
elif file_type == "audio":
- await update.bot.send_audio(
+ await bot.send_audio(
chat_id=update.chat.id,
audio = file_id,
caption = caption,
diff --git a/bot/translation.py b/bot/translation.py
index b72093ebb..17e725dab 100644
--- a/bot/translation.py
+++ b/bot/translation.py
@@ -14,36 +14,8 @@ class Translation(object):
"""
HELP_TEXT = """
-How To Use Me!?
-
-
--> Add Me To Any Group And Make Me Admin
--> Add Me To Your Desired Channel
-
-
-Bot Commands (Works Only In Groups) :
-
- -> /add chat_id
- OR - To Connect A Group With A Channel (Bot Should Be Admin With Full Previlages In Both Group And Channel)
- /add @Username
-
- -> /del chat_id
- OR - To disconnect A Group With A Channel
- /del @Username
-
- -> /delall - This Command Will Disconnect All Connected Channel With The Group And Deletes All Its File From DB
-
- -> /settings - This Command Will Display You A Settings Pannel Instance Which Can Be Used To Tweek Bot's Settings Accordingly
-
- -> Channel - Button Will Show You All The Connected Chats With The Group And Will Show Buttons Correspnding To There Order For Furthur Controls
- -> Filter Types - Button Will Show You The 3 Filter Option Available In Bot... Pressing Each Buttons Will Either Enable or Disable Them And This Will Take Into Action As Soon As You Use Them Without The Need Of A Restart
-
- -> Configure - Button Will Helps You To Change No. of Pages/ Buttons Per Page/ Total Result Without Acutally Editing The Repo... Also It Provide Option To Enable/Disable For Showing Invite Link In Each Results
-
- -> Status - Button Will Shows The Stats Of Your Channel
-
-@CrazyBotsz
+@m_oviezUP4
"""
ABOUT_TEXT = """➥ Name : Auto Filter Bot
@@ -55,4 +27,4 @@ class Translation(object):
➥ Library : Pyrogram Asyncio 1.13.0
➥ Source Code : Click Me
-"""
\ No newline at end of file
+"""