Update plugins/query.py
Browse files- plugins/query.py +50 -5
plugins/query.py
CHANGED
@@ -598,9 +598,55 @@ async def cb_handler(client: Client, query: CallbackQuery):
|
|
598 |
total, used, free = shutil.disk_usage(".")
|
599 |
stats = script.SERVER_STATS.format(get_time(time.time() - client.uptime), psutil.cpu_percent(), psutil.virtual_memory().percent, humanbytes(total), humanbytes(used), psutil.disk_usage('/').percent, humanbytes(free))
|
600 |
stats_pic = await make_carbon(stats, True)
|
601 |
-
|
602 |
-
|
603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
await query.edit_message_media(InputMediaPhoto(stats_pic, script.ADMIN_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
605 |
logger.debug(f"Admin panel processed successfully for user {query.from_user.id}")
|
606 |
except Exception as e:
|
@@ -731,5 +777,4 @@ async def cb_handler(client: Client, query: CallbackQuery):
|
|
731 |
]]
|
732 |
await query.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
|
733 |
logger.debug(f"Settings updated for user {query.from_user.id} in group {grp_id}")
|
734 |
-
|
735 |
-
|
|
|
598 |
total, used, free = shutil.disk_usage(".")
|
599 |
stats = script.SERVER_STATS.format(get_time(time.time() - client.uptime), psutil.cpu_percent(), psutil.virtual_memory().percent, humanbytes(total), humanbytes(used), psutil.disk_usage('/').percent, humanbytes(free))
|
600 |
stats_pic = await make_carbon(stats, True)
|
601 |
+
await query.edit_message_media(InputMediaPhoto(stats_pic, script.ADMIN_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
602 |
+
logger.debug(f"Admin panel processed successfully for user {query.from_user.id}")
|
603 |
+
except Exception as e:
|
604 |
+
logger.error(f"Error processing admin panel callback for user {query.from_user.id}: {e}")
|
605 |
+
await query.message.edit_text("An error occurred while processing your request. Please try again later.")
|
606 |
+
|
607 |
+
elif query.data == "openfilter":
|
608 |
+
buttons = [[
|
609 |
+
InlineKeyboardButton('AᴜᴛᴏFɪʟᴛᴇʀ', 'autofilter'),
|
610 |
+
InlineKeyboardButton('MᴀɴᴜᴀʟFɪʟᴛᴇʀ', 'manuelfilter')
|
611 |
+
],[
|
612 |
+
InlineKeyboardButton('GʟᴏʙᴀʟFɪʟᴛᴇʀ', 'globalfilter')
|
613 |
+
],[
|
614 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
615 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'help')
|
616 |
+
]]
|
617 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.FILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
618 |
+
|
619 |
+
elif query.data == "autofilter":
|
620 |
+
buttons = [[
|
621 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
622 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
623 |
+
]]
|
624 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.AUTOFILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
625 |
+
|
626 |
+
elif query.data == "manuelfilter":
|
627 |
+
buttons = [[
|
628 |
+
InlineKeyboardButton('Bᴜᴛᴛᴏɴ Fᴏʀᴍᴀᴛ', 'button')
|
629 |
+
],[
|
630 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
631 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
632 |
+
]]
|
633 |
+
await query.edit_message_media(InputMediaPhoto(random.choice(PICS), script.MANUELFILTER_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
634 |
+
|
635 |
+
elif query.data == "globalfilter":
|
636 |
+
buttons = [[
|
637 |
+
InlineKeyboardButton('Bᴜᴛᴛᴏɴ Fᴏʀᴍᴀᴛ', 'buttong')
|
638 |
+
],[
|
639 |
+
InlineKeyboardButton('✘ Cʟᴏꜱᴇ', 'close_data'),
|
640 |
+
InlineKeyboardButton('« Bᴀᴄᴋ', 'openfilter')
|
641 |
+
]]
|
642 |
+
if query.from_user.id not in ADMINS:
|
643 |
+
logger.debug(f"User {query.from_user.id} is not an admin")
|
644 |
+
return await query.answer("Sᴏʀʀʏ Tʜɪs Mᴇɴᴜ Oɴʟʏ Fᴏʀ Mʏ Aᴅᴍɪɴs ⚒️", show_alert=True)
|
645 |
+
await query.message.edit_text("Pʀᴏᴄᴇꜱꜱɪɴɢ...")
|
646 |
+
try:
|
647 |
+
total, used, free = shutil.disk_usage(".")
|
648 |
+
stats = script.SERVER_STATS.format(get_time(time.time() - client.uptime), psutil.cpu_percent(), psutil.virtual_memory().percent, humanbytes(total), humanbytes(used), psutil.disk_usage('/').percent, humanbytes(free))
|
649 |
+
stats_pic = await make_carbon(stats, True)
|
650 |
await query.edit_message_media(InputMediaPhoto(stats_pic, script.ADMIN_TXT, enums.ParseMode.HTML), reply_markup=InlineKeyboardMarkup(buttons))
|
651 |
logger.debug(f"Admin panel processed successfully for user {query.from_user.id}")
|
652 |
except Exception as e:
|
|
|
777 |
]]
|
778 |
await query.message.edit_reply_markup(InlineKeyboardMarkup(buttons))
|
779 |
logger.debug(f"Settings updated for user {query.from_user.id} in group {grp_id}")
|
780 |
+
|
|