Skip to content

Commit

Permalink
Fixed some error & improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanjiroop authored Aug 11, 2024
1 parent c46a8bb commit 157890e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/pm_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,27 +1212,30 @@ async def cb_handler(client: Client, query: CallbackQuery):


async def auto_filter(client, msg, spoll=False):
reqstr1 = msg.from_user.id if msg.from_user else 0
reqstr = await client.get_users(reqstr1)
if not spoll:
message = msg
settings = await get_settings(message.chat.id)
if message.text.startswith("/"): return # ignore commands
if re.findall("((^\/|^,|^!|^\.|^[\U0001F600-\U000E007F]).*)", message.text):
return
if 2 < len(message.text) < 100:
if len(message.text) < 100:
search = message.text
files, offset, total_results = await get_search_results(search.lower(), offset=0, filter=True)
if not files:
if settings["spell_check"]:
return await advantage_spell_chok(client, msg)
else:
await client.send_message(chat_id=LOG_CHANNEL, text=(script.NORSLTS.format(reqstr.id, reqstr.mention, search)))
return
else:
return
else:
settings = await get_settings(msg.message.chat.id)
message = msg.message.reply_to_message # msg will be callback query
search, files, offset, total_results = spoll
pre = 'filep' if settings['file_secure'] else 'file'
pre = 'filep' if settings['file_secure'] else 'file'
if settings["button"]:
btn = [
[
Expand Down Expand Up @@ -1316,7 +1319,7 @@ async def auto_filter(client, msg, spoll=False):
**locals()
)
else:
cap = f"Hᴇʀᴇ ɪs ᴡʜᴀᴛ ɪ ғᴏᴜɴᴅ ғᴏʀ ʏᴏᴜʀ ϙᴜᴇʀʏ {search}"
cap = f"<b>ϙᴜᴇʀʏ ʙʏ :- {message.from_user.mention}\nᴛɪᴛʟᴇ: - {search}\nᴛᴏᴛᴀʟ:- {str(total_results)}\nᴘʀᴏᴠɪᴅᴇ ʙʏ {message.chat.title}</b>"
if imdb and imdb.get('poster'):
try:
mes=await message.reply_photo(photo=imdb.get('poster'), caption=cap[:1024],
Expand All @@ -1339,15 +1342,15 @@ async def auto_filter(client, msg, spoll=False):
await dai.delete()
except Exception as e:
logger.exception(e)
andi=await message.reply_text(cap, reply_markup=InlineKeyboardMarkup(btn))
andi=await message.reply_photo(photo=NO_IMDB, caption=cap, reply_markup=InlineKeyboardMarkup(btn))
if settings["auto_delete"]:
await asyncio.sleep(600)
await andi.delete()
dai=await message.reply(f"<b>Hey</b> <i>{message.from_user.first_name}</i>\n\n<b>Your Request Has Been Deleted 👍 \n(Due To Avoid Copyrights Issue😌)\n\nIF YOU WANT THAT FILE, REQUEST AGAIN ❤️</b>")
await asyncio.sleep(100)
await dai.delete()
else:
perfectok=await message.reply_text(cap, reply_markup=InlineKeyboardMarkup(btn))
perfectok=await message.reply_photo(photo=NO_IMDB, caption=cap, reply_markup=InlineKeyboardMarkup(btn))
if settings["auto_delete"]:
await asyncio.sleep(600)
await perfectok.delete()
Expand Down

0 comments on commit 157890e

Please sign in to comment.