Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
12d62cf
Yeh Maybe Fixed It 😅
AlbertEinsteinTG Apr 5, 2021
51134e6
Update callback.py
AlbertEinsteinTG Apr 6, 2021
a94f856
Update callback.py
AlbertEinsteinTG Apr 6, 2021
62b3f97
Update settings.py
AlbertEinsteinTG Apr 6, 2021
a1e591b
Update callback.py
AlbertEinsteinTG Apr 6, 2021
c2a1654
Pure Testing
AlbertEinsteinTG Apr 6, 2021
b21411d
Update callback.py
AlbertEinsteinTG Apr 6, 2021
a40d550
just developing
AlbertEinsteinTG Apr 14, 2021
b63306b
Sort Of Testing
AlbertEinsteinTG Apr 14, 2021
1fa5923
test 2
AlbertEinsteinTG Apr 14, 2021
2a52805
test 3
AlbertEinsteinTG Apr 14, 2021
9d8afa2
test
AlbertEinsteinTG Apr 14, 2021
9d04108
Update database.py
AlbertEinsteinTG Apr 18, 2021
871d2d3
Update database.py
AlbertEinsteinTG Apr 18, 2021
b8e5cc2
Update database.py
AlbertEinsteinTG Apr 18, 2021
03ce0bf
t
AlbertEinsteinTG May 8, 2021
a592922
.....
AlbertEinsteinTG May 8, 2021
3bbe436
Sorted All
AlbertEinsteinTG May 8, 2021
fe7d4d7
Added File_size
AlbertEinsteinTG May 8, 2021
51b1a72
..............
AlbertEinsteinTG May 8, 2021
393b341
....
AlbertEinsteinTG May 8, 2021
3d2e8db
Fixx
AlbertEinsteinTG May 8, 2021
25537a2
Update auto_filter.py
AlbertEinsteinTG May 9, 2021
af7bf14
Update auto_filter.py
AlbertEinsteinTG May 9, 2021
7876b57
Update af_main_cb.py
AlbertEinsteinTG May 9, 2021
bbdfe06
......
AlbertEinsteinTG May 9, 2021
8be93a6
Fix
AlbertEinsteinTG May 9, 2021
86da00b
Fix
AlbertEinsteinTG May 9, 2021
2a03202
Better
AlbertEinsteinTG May 9, 2021
a2b920b
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
83cdefd
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
426e189
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
b092346
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
fd2f38f
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
f30dcbc
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
1048c61
Merging Upstream
AlbertEinsteinTG Jul 28, 2021
1d048b2
Merged Upstream
AlbertEinsteinTG Jul 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Adv Auto Filter Bot V2

<p align="center">
<a href="https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/stargazers">
<img src="https://img.shields.io/github/stars/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2?style=social">
<a href="https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2/stargazers">
<img src="https://img.shields.io/github/stars/CrazyBotsz/Adv-Auto-Filter-Bot-V2?style=social">

</a>

<a href="https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/fork">
<img src="https://img.shields.io/github/forks/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2?label=Fork&style=social">
<a href="https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2/fork">
<img src="https://img.shields.io/github/forks/CrazyBotsz/Adv-Auto-Filter-Bot-V2?label=Fork&style=social">

</a>
</p>

__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__

Expand Down Expand Up @@ -82,8 +82,8 @@ You can deploy this bot anywhere.
<details><summary>Deploy To VPS</summary>
<p>
<pre>
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
Expand All @@ -99,11 +99,12 @@ 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*.


## Credits

- 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)
2 changes: 1 addition & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

USER_SESSION = os.environ.get("USER_SESSION")

VERIFY = {}
CHAT_DETAILS = {}

logging.basicConfig(
level=logging.INFO,
Expand Down
2 changes: 1 addition & 1 deletion bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self):
plugins={
"root": "bot/plugins"
},
workers=4,
workers=400,
bot_token=BOT_TOKEN,
sleep_threshold=10
)
Expand Down
20 changes: 6 additions & 14 deletions bot/database/database.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -446,7 +439,7 @@ async def get_filters(self, group_id: int, keyword: str):
filters = []

pipeline= {
'$text':{'$search': keyword}
'group_id': int(group_id), '$text':{'$search': keyword}
}


Expand Down Expand Up @@ -484,7 +477,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


Expand All @@ -502,4 +495,3 @@ async def tf_count(self, group_id: int):
"""
return await self.fcol.count_documents({"group_id": group_id})


14 changes: 14 additions & 0 deletions bot/plugins/Callbacks/About Btn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from .. import (
FIND,

recacher,
admin_list,
Database,
ACTIVE_CHATS,
CHAT_DETAILS,
INVITE_LINK,
remove_emoji,
time_formatter,
gen_invite_links,
)
from .... import start_uptime
62 changes: 62 additions & 0 deletions bot/plugins/Callbacks/About Btn/abt_main_cb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import re
import time

from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery

from . import (
CHAT_DETAILS,
admin_list,
time_formatter,
start_uptime
)

@Client.on_callback_query(filters.regex(r"about\((.+)\)"), group=2)
async def cb_about(bot, update: CallbackQuery):
"""
A Callback Funtion For Showing About Section In Bot Setting Menu
"""
global CHAT_DETAILS
chat_id = update.message.chat.id
user_id = update.from_user.id

chat_dict = CHAT_DETAILS.get(str(chat_id))
chat_admins = chat_dict.get("admins") if chat_dict != None else None

if ( chat_dict or chat_admins ) == None: # Make Admin's ID List
chat_admins = await admin_list(chat_id, bot, update)

if user_id not in chat_admins:
return

text=f"<i><u>Bot's Status</u></i>\n"
text+=f"\n<b><i>Bot's Uptime:</i></b> <code>{time_formatter(time.time() - start_uptime)}</code>\n"
text+=f"\n<b><i>Bot Funtion:</i></b> <i>Auto Filter Files</i>\n"
text+=f"""\n<b><i>Bot Support:</i></b> <a href="https://t.me/CrazyBotszGrp">@CrazyBotszGrp</a>\n"""
text+="""\n<b><i>Source Code:</i></b> <a href="https://github.com/CrazyBotsz/Adv-Auto-Filter-Bot-V2">Source</a>"""

buttons = [
[
InlineKeyboardButton
(
"My Dev ⚡", url="https://t.me/AlbertEinstein_TG"
),

InlineKeyboardButton
(
"🔙 Back", callback_data="settings"
)
],
[
InlineKeyboardButton
(
"Close 🔐", callback_data="close"
)
]
]

reply_markup = InlineKeyboardMarkup(buttons)

await update.message.edit_text(
text, reply_markup=reply_markup, parse_mode="html"
)
14 changes: 14 additions & 0 deletions bot/plugins/Callbacks/Channels Btn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from .. import (
FIND,

recacher,

admin_list,
Database,
ACTIVE_CHATS,
CHAT_DETAILS,
INVITE_LINK,
remove_emoji,
time_formatter,
gen_invite_links,
)
Loading