Skip to content

Commit

Permalink
Update pmfilter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeflix-Bots authored May 15, 2024
1 parent ebf0ec9 commit eb15b73
Showing 1 changed file with 5 additions and 54 deletions.
59 changes: 5 additions & 54 deletions plugins/pmfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,55 +102,6 @@ async def fil_mod(client, message):
await m.edit("ᴜsᴇ :- /autofilter on ᴏʀ /autofilter off")


@Client.on_message((filters.group) & filters.text & filters.incoming)
async def give_filter(client, message):
await global_filters(client, message)
group_id = message.chat.id
name = message.text
await message.react(emoji=random.choice(REACTIONS))
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")

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_message(filters.group & filters.text & filters.incoming)
async def give_filter(client, message):
if message.chat.id != SUPPORT_CHAT_ID:
Expand All @@ -173,11 +124,11 @@ async def give_filter(client, message):
return
else:
return await message.reply_text(
text=f"<b>{message.from_user.mention},</b>\n\n({str(total_results)}) ʀᴇsᴜʟᴛ ᴀʀᴇ ꜰᴏᴜɴᴅ ɪɴ ᴍʏ ᴅᴀᴛᴀʙᴀsᴇ ꜰᴏʀ ʏᴏᴜʀ sᴇᴀʀᴄʜ [{search}]",
text=f"<b>ʜᴇʏ {message.from_user.mention} {str(total_results)} ʀᴇsᴜʟᴛs ᴀʀᴇ ғᴏᴜɴᴅ ɪɴ ᴍʏ ᴅᴀᴛᴀʙᴀsᴇ ғᴏʀ ʏᴏᴜʀ ᴏ̨ᴜᴇʀʏ <code>{search}</code>. \n\nTʜɪs ɪs ᴀ sᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ sᴏ ᴛʜᴀᴛ ʏᴏᴜ ᴄᴀɴ'ᴛ ɢᴇᴛ ғɪʟᴇs ғʀᴏᴍ ʜᴇʀᴇ...\n\nᴊᴏɪɴ ᴀɴᴅ sᴇᴀʀᴄʜ ʜᴇʀᴇ</b>",
parse_mode=enums.ParseMode.HTML,
reply_markup=InlineKeyboardMarkup(
[[
InlineKeyboardButton('✧ ᴛᴀᴋᴇ ᴍᴏᴠɪᴇ ꜰʀᴏᴍ ʜᴇʀᴇ ✧', url ='https://telegram.me/movie7xchat')
InlineKeyboardButton('• ᴊᴏɪɴ ᴏᴜʀ ᴍᴏᴠɪᴇ ɢʀᴏᴜᴘ •', url ='https://telegram.me/movie7xchat')
]]
)
)
Expand All @@ -190,12 +141,12 @@ async def pm_text(bot, message):
if content.startswith("/") or content.startswith("#"): return # ignore commands and hashtags
if user_id in ADMINS: return # ignore admins
await message.reply_text(
text=f"<b>ʜᴇʏ {user} ,\n\nʏᴏᴜ ᴄᴀɴ'ᴛ ɢᴇᴛ ᴍᴏᴠɪᴇs ꜰʀᴏᴍ ʜᴇʀᴇ. ʀᴇǫᴜᴇsᴛ ɪᴛ ɪɴ ᴏᴜʀ ᴍᴏᴠɪᴇ ɢʀᴏᴜᴘ</a> ᴏʀ ᴄʟɪᴄᴋ ʀᴇǫᴜᴇsᴛ ʜᴇʀᴇ ʙᴜᴛᴛᴏɴ ʙᴇʟᴏᴡ 👇</b>",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("✧ ᴛᴀᴋᴇ ᴍᴏᴠɪᴇ ꜰʀᴏᴍ ʜᴇʀᴇ ✧", url=f"https://t.me/Movie7xChat/4")]])
text="<b>ʜᴇʏ ʙʀᴏ/sɪs, ʏᴏᴜ ᴄᴀɴ'ᴛ ɢᴇᴛ ғɪʟᴇs ғʀᴏᴍ ʜᴇʀᴇ... \n\nᴊᴏɪɴ ᴀɴᴅ sᴇᴀʀᴄʜ ʜᴇʀᴇ</b>",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("• ᴊᴏɪɴ ᴏᴜʀ ᴍᴏᴠɪᴇ ɢʀᴏᴜᴘ • ​ ", url=f"https://telegram.me/movie7xchat")]]), disable_web_page_preview=True
)
await bot.send_message(
chat_id=LOG_CHANNEL,
text=f"<b>#pm_msge\n\nNᴀᴍᴇ : {user}\n\nID : {user_id}\n\nMᴇssᴀɢᴇ : {content}</b>"
text=f"<b>#𝐌𝐒𝐆\n\nNᴀᴍᴇ : {user}\n\nID : {user_id}\n\nMᴇssᴀɢᴇ : {content}</b>"
)

@Client.on_callback_query(filters.regex(r"^next"))
Expand Down

0 comments on commit eb15b73

Please sign in to comment.