Skip to content

Commit

Permalink
Update pm_filter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VJBots authored Dec 7, 2024
1 parent e25be60 commit ad4da3d
Showing 1 changed file with 33 additions and 57 deletions.
90 changes: 33 additions & 57 deletions plugins/pm_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,10 @@ async def filter_seasons_cb_handler(client: Client, query: CallbackQuery):
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇs", callback_data=f"languages#{key}"),
InlineKeyboardButton("ʏᴇᴀʀs", callback_data=f"years#{key}")
])
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ↭", callback_data=f"next_{req}_{key}_{offset}")])
if lang != "homepage":
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ↭", callback_data=f"next_{req}_{key}_{offset}")])

if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
Expand All @@ -936,7 +937,6 @@ async def filter_seasons_cb_handler(client: Client, query: CallbackQuery):
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
except MessageNotModified:
pass
await query.answer()

@Client.on_callback_query(filters.regex(r"^qualities#"))
async def qualities_cb_handler(client: Client, query: CallbackQuery):
Expand Down Expand Up @@ -1024,57 +1024,25 @@ async def filter_qualities_cb_handler(client: Client, query: CallbackQuery):
btn = [
[
InlineKeyboardButton(
text=f"⚜️[{get_size(file['file_size'])}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file['file_name'].split()))}", callback_data=f'{pre}#{file["file_id"]}'
text=f"[{get_size(file['file_size'])}] {' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file['file_name'].split()))}", callback_data=f'{pre}#{file["file_id"]}'
),
]
for file in files
]
else:
btn = [
btn.insert(0,
[
InlineKeyboardButton(
text=f"{' '.join(filter(lambda x: not x.startswith('[') and not x.startswith('@') and not x.startswith('www.'), file['file_name'].split()))}",
callback_data=f'{pre}#{file["file_id"]}',
),
InlineKeyboardButton(
text=f"{get_size(file['file_size'])}",
callback_data=f'{pre}#{file["file_id"]}',
),
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ᴇᴘɪsᴏᴅᴇs", callback_data=f"episodes#{key}"),
InlineKeyboardButton("sᴇᴀsᴏɴs", callback_data=f"seasons#{key}")
]
for file in files
]

try:
if settings['auto_delete']:
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ᴇᴘɪsᴏᴅᴇs", callback_data=f"episodes#{key}"),
InlineKeyboardButton("sᴇᴀsᴏɴs", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("𝐒𝐞𝐧𝐝 𝐀𝐥𝐥", callback_data=f"sendfiles#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇs", callback_data=f"languages#{key}"),
InlineKeyboardButton("ʏᴇᴀʀs", callback_data=f"years#{key}")
])

else:
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
InlineKeyboardButton("ᴇᴘɪsᴏᴅᴇs", callback_data=f"episodes#{key}"),
InlineKeyboardButton("sᴇᴀsᴏɴs", callback_data=f"seasons#{key}")
]
)
btn.insert(0, [
InlineKeyboardButton("𝐒𝐞𝐧𝐝 𝐀𝐥𝐥", callback_data=f"sendfiles#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇs", callback_data=f"languages#{key}"),
InlineKeyboardButton("ʏᴇᴀʀs", callback_data=f"years#{key}")
])

except KeyError:
await save_group_settings(query.message.chat.id, 'auto_delete', True)
)
btn.insert(0, [
InlineKeyboardButton("𝐒𝐞𝐧𝐝 𝐀𝐥𝐥", callback_data=f"sendfiles#{key}"),
InlineKeyboardButton("ʟᴀɴɢᴜᴀɢᴇs", callback_data=f"languages#{key}"),
InlineKeyboardButton("ʏᴇᴀʀs", callback_data=f"years#{key}")
])
else:
btn = []
btn.insert(0,
[
InlineKeyboardButton(f'ǫᴜᴀʟɪᴛʏ', callback_data=f"qualities#{key}"),
Expand Down Expand Up @@ -1112,14 +1080,22 @@ async def filter_qualities_cb_handler(client: Client, query: CallbackQuery):
req = query.from_user.id
offset = 0
btn.append([InlineKeyboardButton(text="↭ ʙᴀᴄᴋ ᴛᴏ ʜᴏᴍᴇ ↭", callback_data=f"next_{req}_{key}_{offset}")])
try:
await query.edit_message_reply_markup(
reply_markup=InlineKeyboardMarkup(btn)
)
except MessageNotModified:
pass
await query.answer()


if not settings["button"]:
cur_time = datetime.now(pytz.timezone('Asia/Kolkata')).time()
time_difference = timedelta(hours=cur_time.hour, minutes=cur_time.minute, seconds=(cur_time.second+(cur_time.microsecond/1000000))) - timedelta(hours=curr_time.hour, minutes=curr_time.minute, seconds=(curr_time.second+(curr_time.microsecond/1000000)))
remaining_seconds = "{:.2f}".format(time_difference.total_seconds())
total_results = len(files)
cap = await get_cap(settings, remaining_seconds, files, query, total_results, search)
try:
await query.message.edit_text(text=cap, reply_markup=InlineKeyboardMarkup(btn), disable_web_page_preview=True)
except MessageNotModified:
pass
else:
try:
await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(btn))
except MessageNotModified:
pass

@Client.on_callback_query()
async def cb_handler(client: Client, query: CallbackQuery):
Expand Down

0 comments on commit ad4da3d

Please sign in to comment.