Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d55ab0e
Support For Multiple Bots In Same DB URI
AlbertEinsteinTG Jun 8, 2021
4b5c920
Oops Mistakes😬😅
AlbertEinsteinTG Jun 11, 2021
613fab0
Ownership Transfer
AlbertEinsteinTG Jun 14, 2021
aa5bca3
Redirect
AlbertEinsteinTG Jun 14, 2021
0d362bc
Fix!
AlbertEinsteinTG Jun 14, 2021
9c50553
Technical Move 😁
AlbertEinsteinTG Jun 14, 2021
5328dc3
Better Way?
AlbertEinsteinTG Jul 10, 2021
f12b2da
Mammanodu Onnum Thonnale.......
AlbertEinsteinTG Jul 11, 2021
d552047
Does this fix?👀
AlbertEinsteinTG Jul 18, 2021
6eeea01
Update database.py
AlbertEinsteinTG Jul 29, 2021
f19bff7
Update database.py
AlbertEinsteinTG Jul 29, 2021
d5ba21d
Link updated
AlbertEinsteinTG Nov 30, 2021
3602457
Updates
AlbertEinsteinTG Nov 30, 2021
1a8e104
Link updated
AlbertEinsteinTG Nov 30, 2021
a4495d3
Log Exception
AlbertEinsteinTG Nov 30, 2021
f3b222c
Log Exception
AlbertEinsteinTG Nov 30, 2021
a0227a6
Work around
AlbertEinsteinTG Dec 1, 2021
f51913a
Merge branch 'CrazyBotsz:main' into main
AlbertEinsteinTG Dec 1, 2021
a72c7a7
Work Around
AlbertEinsteinTG Dec 1, 2021
c63d2c4
Update Readme.md
AlbertEinsteinTG Dec 21, 2021
1d0fd11
Maybe....🚶‍♂️
AlbertEinsteinTG Dec 23, 2021
eba0e3a
hmm....
AlbertEinsteinTG Dec 25, 2021
990dbfa
Redirect
AlbertEinsteinTG Jan 20, 2022
b4c6d1a
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
a033f8e
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
86f822b
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
5b7698a
Update commands.py
AlbertEinsteinTG Apr 24, 2022
60e54cd
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
c2d1a38
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
0a679a8
Update callback.py
AlbertEinsteinTG Apr 24, 2022
7d9da08
Pyro 2.0
AlbertEinsteinTG Apr 24, 2022
1fdcdb5
Minor fix!
AlbertEinsteinTG Apr 24, 2022
b1391fc
Minor Fix!
AlbertEinsteinTG Apr 24, 2022
b05bc27
Merge pull request #107 from AlbertEinsteinTG/main
AlbertEinsteinTG Apr 24, 2022
10c54c5
Fix!
AlbertEinsteinTG Apr 27, 2022
c42ac03
...
AlbertEinsteinTG May 5, 2022
e74c382
Fixed "Invalid parse mode"
AlbertEinsteinTG May 5, 2022
1b7b0c1
Pyro 2.0
AlbertEinsteinTG May 9, 2022
b068f02
Pyro 2.0
AlbertEinsteinTG May 20, 2022
d59ab35
Try?
AlbertEinsteinTG Jun 3, 2022
5dc22af
Try?
AlbertEinsteinTG Jun 27, 2022
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
19 changes: 10 additions & 9 deletions Readme.md → 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 @@ -73,7 +73,7 @@ You can deploy this bot anywhere.
<details><summary>Deploy To Heroku</summary>
<p>
<br>
<a href="https://heroku.com/deploy?template=https://github.com/AlbertEinsteinTG/Adv-Auto-Filter-Bot-V2/tree/main">
<a href="https://github.com/AlbertEinsteinTG/af-deploy-script">
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy">
</a>
</p>
Expand All @@ -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)
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -20,7 +20,7 @@ def __init__(self):
plugins={
"root": "bot/plugins"
},
workers=4,
workers=200,
bot_token=BOT_TOKEN,
sleep_threshold=10
)
Expand All @@ -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! "
)
Expand Down
21 changes: 6 additions & 15 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 @@ -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)
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions bot/plugins/auto_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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_

Expand Down Expand Up @@ -205,8 +205,8 @@ async def auto_filter(bot, update):
chat_id = update.chat.id,
text=f"Found {(len_results)} Results For Your Query: <code>{query}</code>",
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:
Expand Down
Loading