chore(userbot): apply ruff check --fix and ruff format

- ruff check --fix: 210 auto-fixed errors (import sorting, trailing
  whitespace, unused imports, f-string fixups, deprecated annotations)
- ruff format: 104 files reformatted to consistent style
- 268 non-auto-fixable issues remain (S113 requests timeout, etc.)
This commit is contained in:
2026-06-19 12:19:01 +02:00
parent 95cec59263
commit 7ba6bc44f2
104 changed files with 4338 additions and 5319 deletions
+21 -23
View File
@@ -13,18 +13,17 @@
from pyrogram import Client, filters
from pyrogram.types import Message
from utils.misc import modules_help, prefix
from utils.scripts import format_module_help, with_reply
from utils.module import ModuleManager
from utils.scripts import format_module_help, with_reply
module_manager = ModuleManager.get_instance()
@Client.on_message(filters.command(["help", "h"], prefix) & filters.me)
@Client.on_message(filters.command(['help', 'h'], prefix) & filters.me)
async def help_cmd(_, message: Message):
if not module_manager.help_navigator:
await message.edit("<b>Help system is not initialized yet. Please wait...</b>")
await message.edit('<b>Help system is not initialized yet. Please wait...</b>')
return
if len(message.command) == 1:
@@ -41,43 +40,42 @@ async def help_cmd(_, message: Message):
cmd_desc = commands[command]
module_found = True
return await message.edit(
f"<b>Help for command <code>{prefix}{command_name}</code></b>\n"
f"Module: {module_name} (<code>{prefix}help {module_name}</code>)\n\n"
f"<code>{prefix}{cmd[0]}</code>"
f"{' <code>' + cmd[1] + '</code>' if len(cmd) > 1 else ''}"
f" — <i>{cmd_desc}</i>",
f'<b>Help for command <code>{prefix}{command_name}</code></b>\n'
f'Module: {module_name} (<code>{prefix}help {module_name}</code>)\n\n'
f'<code>{prefix}{cmd[0]}</code>'
f'{" <code>" + cmd[1] + "</code>" if len(cmd) > 1 else ""}'
f' — <i>{cmd_desc}</i>',
)
if not module_found:
await message.edit(f"<b>Module or command {command_name} not found</b>")
await message.edit(f'<b>Module or command {command_name} not found</b>')
@Client.on_message(filters.command(["pn", "pp", "pq"], prefix) & filters.me)
@Client.on_message(filters.command(['pn', 'pp', 'pq'], prefix) & filters.me)
@with_reply
async def handle_navigation(_, message: Message):
if not module_manager.help_navigator:
await message.edit("<b>Help system is not initialized yet. Please wait...</b>")
await message.edit('<b>Help system is not initialized yet. Please wait...</b>')
return
reply_message = message.reply_to_message
if reply_message and "Help Page No:" in message.reply_to_message.text:
if reply_message and 'Help Page No:' in message.reply_to_message.text:
cmd = message.command[0].lower()
if cmd == "pn":
if cmd == 'pn':
if module_manager.help_navigator.next_page():
await module_manager.help_navigator.send_page(reply_message)
return await message.delete()
await message.edit("No more pages available.")
elif cmd == "pp":
await message.edit('No more pages available.')
elif cmd == 'pp':
if module_manager.help_navigator.prev_page():
await module_manager.help_navigator.send_page(reply_message)
return await message.delete()
return await message.edit("This is the first page.")
elif cmd == "pq":
return await message.edit('This is the first page.')
elif cmd == 'pq':
await reply_message.delete()
return await message.edit("Help closed.")
return await message.edit('Help closed.')
modules_help["help"] = {
"help [module/command name]": "Get common/module/command help",
"pn/pp/pq": "Navigate through help pages"
+ " (pn: next page, pp: previous page, pq: quit help)",
modules_help['help'] = {
'help [module/command name]': 'Get common/module/command help',
'pn/pp/pq': 'Navigate through help pages' + ' (pn: next page, pp: previous page, pq: quit help)',
}