From 69a2ecaefbec263e06c5bb09e1dea6cbec872320 Mon Sep 17 00:00:00 2001
From: Sachin S <86321236+sachin9742s@users.noreply.github.com>
Date: Sat, 17 Jul 2021 18:09:04 +0530
Subject: [PATCH 1/3] Update filters.py
---
plugins/filters.py | 90 +++++++++++++++++++++++++++++-----------------
1 file changed, 57 insertions(+), 33 deletions(-)
diff --git a/plugins/filters.py b/plugins/filters.py
index 13c1995..3ec661a 100644
--- a/plugins/filters.py
+++ b/plugins/filters.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# @trojanzhex
+# @KicchaRequest
import re
@@ -20,7 +20,9 @@
from bot import Bot
from script import script
-from config import MAINCHANNEL_ID
+from database.mdb import searchquery
+from plugins.channel import deleteallfilters
+from config import AUTH_USERS
BUTTONS = {}
@@ -29,15 +31,20 @@ async def filter(client: Bot, message: Message):
if re.findall("((^\/|^,|^!|^\.|^[\U0001F600-\U000E007F]).*)", message.text):
return
- if len(message.text) > 2:
+ if 2 < len(message.text) < 50:
btn = []
- async for msg in client.USER.search_messages(MAINCHANNEL_ID,query=message.text,filter='document'):
- file_name = msg.document.file_name
- msg_id = msg.message_id
- link = msg.link
- btn.append(
- [InlineKeyboardButton(text=f"{file_name}",url=f"{link}")]
- )
+
+ group_id = message.chat.id
+ name = message.text
+
+ filenames, links = await searchquery(group_id, name)
+ if filenames and links:
+ for filename, link in zip(filenames, links):
+ btn.append(
+ [InlineKeyboardButton(text=f"{filename}",url=f"{link}")]
+ )
+ else:
+ return
if not btn:
return
@@ -52,10 +59,13 @@ async def filter(client: Bot, message: Message):
else:
buttons = btn
buttons.append(
- [InlineKeyboardButton(text="๐ Pages 1/1",callback_data="pages")]
+ [InlineKeyboardButton(text="๐ต Pages 1/1 ๐ต",callback_data="pages")]
)
await message.reply_text(
- f" Here is the result for {message.text}",
+ f" Title :
+๐ Year :
+๐ Language :
+๐ฟ Quality : {message.text}",
reply_markup=InlineKeyboardMarkup(buttons)
)
return
@@ -64,21 +74,27 @@ async def filter(client: Bot, message: Message):
buttons = data['buttons'][0].copy()
buttons.append(
- [InlineKeyboardButton(text="NEXT โฉ",callback_data=f"next_0_{keyword}")]
+ [InlineKeyboardButton(text="๐ถ NEXT ๐ถ",callback_data=f"next_0_{keyword}")]
)
buttons.append(
- [InlineKeyboardButton(text=f"๐ Pages 1/{data['total']}",callback_data="pages")]
+ [InlineKeyboardButton(text=f"๐ต Pages 1/{data['total']}",callback_data="pages")]
)
await message.reply_text(
- f" Here is the result for {message.text}",
+ f" Title :
+๐ Year :
+๐ Language :
+๐ฟ Quality : {message.text}",
reply_markup=InlineKeyboardMarkup(buttons)
)
@Client.on_callback_query()
async def cb_handler(client: Bot, query: CallbackQuery):
- if query.message.reply_to_message.from_user.id == query.from_user.id:
+ clicked = query.from_user.id
+ typed = query.message.reply_to_message.from_user.id
+
+ if (clicked == typed) or (clicked in AUTH_USERS):
if query.data.startswith("next"):
await query.answer()
@@ -89,10 +105,10 @@ async def cb_handler(client: Bot, query: CallbackQuery):
buttons = data['buttons'][int(index)+1].copy()
buttons.append(
- [InlineKeyboardButton("โช BACK", callback_data=f"back_{int(index)+1}_{keyword}")]
+ [InlineKeyboardButton("๐ถ BACK", callback_data=f"back_{int(index)+1}_{keyword}")]
)
buttons.append(
- [InlineKeyboardButton(f"๐ Pages {int(index)+2}/{data['total']}", callback_data="pages")]
+ [InlineKeyboardButton(f"๐ต Pages {int(index)+2}/{data['total']}", callback_data="pages")]
)
await query.edit_message_reply_markup(
@@ -103,10 +119,10 @@ async def cb_handler(client: Bot, query: CallbackQuery):
buttons = data['buttons'][int(index)+1].copy()
buttons.append(
- [InlineKeyboardButton("โช BACK", callback_data=f"back_{int(index)+1}_{keyword}"),InlineKeyboardButton("NEXT โฉ", callback_data=f"next_{int(index)+1}_{keyword}")]
+ [InlineKeyboardButton("๐ธ BACK ๐ธ", callback_data=f"back_{int(index)+1}_{keyword}"),InlineKeyboardButton("๐น NEXT ๐น", callback_data=f"next_{int(index)+1}_{keyword}")]
)
buttons.append(
- [InlineKeyboardButton(f"๐ Pages {int(index)+2}/{data['total']}", callback_data="pages")]
+ [InlineKeyboardButton(f"๐ต Pages {int(index)+2}/{data['total']}", callback_data="pages")]
)
await query.edit_message_reply_markup(
@@ -124,10 +140,10 @@ async def cb_handler(client: Bot, query: CallbackQuery):
buttons = data['buttons'][int(index)-1].copy()
buttons.append(
- [InlineKeyboardButton("NEXT โฉ", callback_data=f"next_{int(index)-1}_{keyword}")]
+ [InlineKeyboardButton("๐ธ NEXT ๐ธ", callback_data=f"next_{int(index)-1}_{keyword}")]
)
buttons.append(
- [InlineKeyboardButton(f"๐ Pages {int(index)}/{data['total']}", callback_data="pages")]
+ [InlineKeyboardButton(f"๐ต Pages {int(index)}/{data['total']}", callback_data="pages")]
)
await query.edit_message_reply_markup(
@@ -138,10 +154,10 @@ async def cb_handler(client: Bot, query: CallbackQuery):
buttons = data['buttons'][int(index)-1].copy()
buttons.append(
- [InlineKeyboardButton("โช BACK", callback_data=f"back_{int(index)-1}_{keyword}"),InlineKeyboardButton("NEXT โฉ", callback_data=f"next_{int(index)-1}_{keyword}")]
+ [InlineKeyboardButton("๐น BACK ๐น", callback_data=f"back_{int(index)-1}_{keyword}"),InlineKeyboardButton("NEXT ๐ถ", callback_data=f"next_{int(index)-1}_{keyword}")]
)
buttons.append(
- [InlineKeyboardButton(f"๐ Pages {int(index)}/{data['total']}", callback_data="pages")]
+ [InlineKeyboardButton(f"๐ต Pages {int(index)}/{data['total']}", callback_data="pages")]
)
await query.edit_message_reply_markup(
@@ -157,9 +173,9 @@ async def cb_handler(client: Bot, query: CallbackQuery):
elif query.data == "start_data":
await query.answer()
keyboard = InlineKeyboardMarkup([
- [InlineKeyboardButton("HELP", callback_data="help_data"),
- InlineKeyboardButton("ABOUT", callback_data="about_data")],
- [InlineKeyboardButton("โญ๏ธ JOIN OUR CHANNEL โญ๏ธ", url="https://t.me/TroJanzHEX")]
+ [InlineKeyboardButton("เฟ HELP", callback_data="help_data"),
+ InlineKeyboardButton("ABOUT เฟ", callback_data="about_data")],
+ [InlineKeyboardButton("ใ JOIN OUR CHANNEL ใ ", url="https://t.me/ROCKHDMOVIES2021")]
])
await query.message.edit_text(
@@ -172,9 +188,9 @@ async def cb_handler(client: Bot, query: CallbackQuery):
elif query.data == "help_data":
await query.answer()
keyboard = InlineKeyboardMarkup([
- [InlineKeyboardButton("BACK", callback_data="start_data"),
- InlineKeyboardButton("ABOUT", callback_data="about_data")],
- [InlineKeyboardButton("โญ๏ธ SUPPORT โญ๏ธ", url="https://t.me/TroJanzSupport")]
+ [InlineKeyboardButton("โ BACK", callback_data="start_data"),
+ InlineKeyboardButton("ABOUT โ", callback_data="about_data")],
+ [InlineKeyboardButton("๊ง SUPPORT ๊ง", url="https://t.me/KicchaRequest")]
])
await query.message.edit_text(
@@ -187,9 +203,9 @@ async def cb_handler(client: Bot, query: CallbackQuery):
elif query.data == "about_data":
await query.answer()
keyboard = InlineKeyboardMarkup([
- [InlineKeyboardButton("BACK", callback_data="help_data"),
- InlineKeyboardButton("START", callback_data="start_data")],
- [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Auto-Filter-Bot")]
+ [InlineKeyboardButton("๐น BACK ๐น", callback_data="help_data"),
+ InlineKeyboardButton("๐ START ๐", callback_data="start_data")],
+ [InlineKeyboardButton("ึ Join Channel ึ", url="https://t.me/GD_FILMCLUB")]
])
await query.message.edit_text(
@@ -199,6 +215,14 @@ async def cb_handler(client: Bot, query: CallbackQuery):
)
+ elif query.data == "delallconfirm":
+ await query.message.delete()
+ await deleteallfilters(client, query.message)
+
+ elif query.data == "delallcancel":
+ await query.message.reply_to_message.delete()
+ await query.message.delete()
+
else:
await query.answer("Thats not for you!!",show_alert=True)
From c7088926a77ffdfc14eed2257c1624b115644aac Mon Sep 17 00:00:00 2001
From: Sachin S <86321236+sachin9742s@users.noreply.github.com>
Date: Sat, 17 Jul 2021 18:11:29 +0530
Subject: [PATCH 2/3] Update commands.py
---
plugins/commands.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/commands.py b/plugins/commands.py
index 82fd969..7f74eef 100644
--- a/plugins/commands.py
+++ b/plugins/commands.py
@@ -22,7 +22,7 @@ async def start(client, message):
],
[
InlineKeyboardButton(
- "โญ๏ธ JOIN OUR CHANNEL โญ๏ธ", url="https://t.me/TroJanzHEX")
+ "โญ๏ธ JOIN OUR CHANNEL โญ๏ธ", url="https://t.me/KicchaRequest")
]
]
),
@@ -45,7 +45,7 @@ async def help(client, message):
],
[
InlineKeyboardButton(
- "โญ๏ธ SUPPORT โญ๏ธ", url="https://t.me/TroJanzSupport")
+ "โญ๏ธ SUPPORT โญ๏ธ", url="https://t.me/KicchaRequest")
]
]
),
@@ -75,4 +75,4 @@ async def about(client, message):
reply_to_message_id=message.message_id
)
except:
- pass
\ No newline at end of file
+ pass
From 12d8e419305840272db9e2882f5e8ab5c5e3dafc Mon Sep 17 00:00:00 2001
From: Sachin S <86321236+sachin9742s@users.noreply.github.com>
Date: Sat, 17 Jul 2021 18:12:27 +0530
Subject: [PATCH 3/3] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index deef568..07b687c 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Thanks to [InfotelGroup](https://telegram.dog/InFoTelGroup) and [Erich Daniken](
## Installation
### Deploy to Heroku
-[](https://heroku.com/deploy?template=https://github.com/TroJanzHEX/Auto-Filter-Bot)
+[](https://github.com/sachin9742s/Auto-Filter-Bot)
### Deploy in your vps
```sh