From e8a30afad42775b4be139c27d6a0c9b93041d27c Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Wed, 21 Apr 2021 14:08:34 +0530 Subject: [PATCH 01/13] Fixed Error Raised When A Invalid UID is Provided --- bot/database/database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bot/database/database.py b/bot/database/database.py index 8241abfa8..dcf5e7f47 100644 --- a/bot/database/database.py +++ b/bot/database/database.py @@ -477,6 +477,8 @@ 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") From 2e19ea0900bda0198fea2e7a23a45976bf173e8c Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Fri, 23 Apr 2021 08:23:08 +0530 Subject: [PATCH 02/13] Update commands.py --- bot/plugins/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, From bd3a60ebca5a9a153da01d5d36b628326470cbcd Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Fri, 23 Apr 2021 21:00:57 +0530 Subject: [PATCH 03/13] =?UTF-8?q?Fixed=20Some=20Adaptive=20Issues=20?= =?UTF-8?q?=F0=9F=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/plugins/callback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From baee87b48bbd3da99ad5a2636549c13020677af2 Mon Sep 17 00:00:00 2001 From: Shahsad Kolathur Date: Mon, 10 May 2021 11:00:40 +0530 Subject: [PATCH 04/13] Update channel.py --- bot/plugins/channel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py index 2ea646b89..f05c81095 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, From f347d8c750e439f11e5809e83cc23a5d76223a7c Mon Sep 17 00:00:00 2001 From: Shahsad Kolathur Date: Mon, 10 May 2021 11:04:50 +0530 Subject: [PATCH 05/13] Update channel.py --- bot/plugins/channel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py index f05c81095..41a7b4d34 100644 --- a/bot/plugins/channel.py +++ b/bot/plugins/channel.py @@ -300,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, " ") @@ -342,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, From 0693188912ac06e22c6f20e7397b750cdf612e78 Mon Sep 17 00:00:00 2001 From: Shahsad Kolathur Date: Mon, 10 May 2021 11:11:04 +0530 Subject: [PATCH 06/13] Update auto_filter.py --- bot/plugins/auto_filter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/plugins/auto_filter.py b/bot/plugins/auto_filter.py index c5248420e..db99bc162 100644 --- a/bot/plugins/auto_filter.py +++ b/bot/plugins/auto_filter.py @@ -62,6 +62,7 @@ async def auto_filter(bot, update): if filters: for filter in filters: # iterating through each files file_name = filter.get("file_name") + file_size = "[" + str(filter.get("file_size")//1048576) + "MB] " file_type = filter.get("file_type") file_link = filter.get("file_link") @@ -102,7 +103,7 @@ async def auto_filter(bot, update): results.append( [ - InlineKeyboardButton(file_name, url=file_link) + InlineKeyboardButton(file_size + file_name, url=file_link) ] ) From 70962f1cc7f452584a005444e3d1c68a31aca59c Mon Sep 17 00:00:00 2001 From: Inuka Asith Date: Mon, 10 May 2021 11:23:56 +0530 Subject: [PATCH 07/13] Ignore Bot messages in autofilter added & ~filters.bot to line 18 of auto_filter.py Bot replying to bot messages in groups. --- bot/plugins/auto_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/plugins/auto_filter.py b/bot/plugins/auto_filter.py index c5248420e..751f210c9 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 From 22943d5850b0556ca44859ecb88ca654bff28561 Mon Sep 17 00:00:00 2001 From: Shahsad Kolathur Date: Mon, 10 May 2021 12:39:48 +0530 Subject: [PATCH 08/13] Update auto_filter.py --- bot/plugins/auto_filter.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bot/plugins/auto_filter.py b/bot/plugins/auto_filter.py index db99bc162..c0a5271f7 100644 --- a/bot/plugins/auto_filter.py +++ b/bot/plugins/auto_filter.py @@ -62,10 +62,28 @@ async def auto_filter(bot, update): if filters: for filter in filters: # iterating through each files file_name = filter.get("file_name") - file_size = "[" + str(filter.get("file_size")//1048576) + "MB] " 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 @@ -103,7 +121,7 @@ async def auto_filter(bot, update): results.append( [ - InlineKeyboardButton(file_size + file_name, url=file_link) + InlineKeyboardButton(button_text, url=file_link) ] ) From 3318eb69b9e02b1a31e2405a0821a5cfb1f776aa Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Mon, 10 May 2021 17:06:53 +0530 Subject: [PATCH 09/13] Update channel.py --- bot/plugins/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py index 41a7b4d34..0d163e958 100644 --- a/bot/plugins/channel.py +++ b/bot/plugins/channel.py @@ -167,7 +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_size=file_size, file_type=file_type, file_link=file_link, chat_id=channel_id, From ef78257dcbb1572c8e965ed28f3a570b9bd935e2 Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Fri, 14 May 2021 18:37:16 +0530 Subject: [PATCH 10/13] Update database.py --- bot/database/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/database/database.py b/bot/database/database.py index dcf5e7f47..9a20b3b8c 100644 --- a/bot/database/database.py +++ b/bot/database/database.py @@ -484,7 +484,7 @@ async def get_file(self, unique_id: str): 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 From 5c39744fa7ec86c97da657ee83d1a71f1c8ae4f2 Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Sat, 15 May 2021 17:43:38 +0530 Subject: [PATCH 11/13] Bug Fix Bug: Same result showing multiple times.. --- bot/database/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/database/database.py b/bot/database/database.py index 9a20b3b8c..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} } From 1780fb4c209fe3a107c610bb3eccf2063b5c7dae Mon Sep 17 00:00:00 2001 From: Albert Einstein <73480087+AlbertEinsteinTG@users.noreply.github.com> Date: Tue, 18 May 2021 15:11:47 +0530 Subject: [PATCH 12/13] Bug Fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Should Be Fixing https://t.me/CrazyBotszGrp/39334 🤔🤔 --- bot/plugins/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/plugins/channel.py b/bot/plugins/channel.py index 0d163e958..cc8478c6e 100644 --- a/bot/plugins/channel.py +++ b/bot/plugins/channel.py @@ -284,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.. From 682b9abcd11930e6eab5b01b6326418a709835dc Mon Sep 17 00:00:00 2001 From: dirty-byme <85059248+dirty-byme@users.noreply.github.com> Date: Mon, 31 May 2021 16:33:58 +0530 Subject: [PATCH 13/13] Update translation.py --- bot/translation.py | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) 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 +"""