Skip to content

Commit

Permalink
Update pm_filter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Aadhi000 authored Apr 12, 2022
1 parent 0c5241c commit f95470f
Showing 1 changed file with 49 additions and 10 deletions.
59 changes: 49 additions & 10 deletions plugins/pm_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,67 @@ async def fil_mod(client, message):
try:
args = message.text.split(None, 1)[1].lower()
except:
return await message.reply("Incomplete Command...")
return await message.reply("**π™Έπ™½π™²π™Ύπ™Όπ™Ώπ™»π™΄πšƒπ™΄ 𝙲𝙾𝙼𝙼𝙰𝙽𝙳...**")

m = await message.reply("Setting.../")
m = await message.reply("**πš‚π™΄πšƒπšƒπ™Έπ™½π™Ά.../**")

if args in mode_on:
FILTER_MODE[str(message.chat.id)] = "True"
await m.edit("Autofilter Enabled successfully")
await m.edit("**π™°πš„πšƒπ™Ύπ™΅π™Έπ™»πšƒπ™΄πš 𝙴𝙽𝙰𝙱𝙻𝙴𝙳**")

elif args in mode_of:
FILTER_MODE[str(message.chat.id)] = "False"
await m.edit("Autofilter disabled successfully")
await m.edit("**π™°πš„πšƒπ™Ύπ™΅π™Έπ™»πšƒπ™΄πš π™³π™Έπš‚π™°π™±π™»π™΄π™³**")
else:
await m.edit("Use :- /autofilter on Or /autofilter off")
await m.edit("πš„πš‚π™΄ :- /autofilter on π™Ύπš /autofilter off")

@Client.on_message(filters.group & filters.text & filters.incoming)
async def give_filter(client,message):
group_id = message.chat.id
name = message.text

keywords = await get_filters(group_id)
for keyword in reversed(sorted(keywords, key=len)):
pattern = r"( |^|[^\w])" + re.escape(keyword) + r"( |$|[^\w])"
if re.search(pattern, name, flags=re.IGNORECASE):
reply_text, btn, alert, fileid = await find_filter(group_id, keyword)

if reply_text:
reply_text = reply_text.replace("\\n", "\n").replace("\\t", "\t")

@Client.on_message(filters.group & filters.text & ~filters.edited & filters.incoming)
async def give_filter(client,message):
k = await manual_filters(client, message)
if k == False:
await auto_filter(client, message)
if btn is not None:
try:
if fileid == "None":
if btn == "[]":
await message.reply_text(reply_text, disable_web_page_preview=True)
else:
button = eval(btn)
await message.reply_text(
reply_text,
disable_web_page_preview=True,
reply_markup=InlineKeyboardMarkup(button)
)
elif btn == "[]":
await message.reply_cached_media(
fileid,
caption=reply_text or ""
)
else:
button = eval(btn)
await message.reply_cached_media(
fileid,
caption=reply_text or "",
reply_markup=InlineKeyboardMarkup(button)
)
except Exception as e:
print(e)
break

else:
if FILTER_MODE.get(str(message.chat.id)) == "False":
return
else:
await auto_filter(client, message)

@Client.on_callback_query(filters.regex(r"^next"))
async def next_page(bot, query):
Expand Down

0 comments on commit f95470f

Please sign in to comment.