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
+20 -22
View File
@@ -1,8 +1,8 @@
from pyrogram import Client, filters, enums
from pyrogram.types import Message
from os import listdir
from pyrogram import Client, enums, filters
from pyrogram.types import Message
# noinspection PyUnresolvedReferences
from utils.misc import modules_help, prefix
@@ -10,7 +10,7 @@ from utils.misc import modules_help, prefix
from utils.scripts import format_exc
@Client.on_message(filters.command(["lback"], prefix) & filters.me)
@Client.on_message(filters.command(['lback'], prefix) & filters.me)
async def backup_database_cmd(_: Client, message: Message):
"""
Backup the database.
@@ -18,42 +18,40 @@ async def backup_database_cmd(_: Client, message: Message):
if len(message.command) == 1:
await message.edit("[😇] I think you didn't specify the name of the bot.")
return
await message.edit_text(
"<b>I'm copying the database...</b>", parse_mode=enums.ParseMode.HTML
)
await message.edit_text("<b>I'm copying the database...</b>", parse_mode=enums.ParseMode.HTML)
try:
name = message.command[1].lower()
folders = listdir("/root/")
folders = listdir('/root/')
if name not in folders:
await message.edit("[😇] There is no such bot in the root folder.")
await message.edit('[😇] There is no such bot in the root folder.')
return
folder = listdir("/root/" + name)
folder = listdir('/root/' + name)
for file in folder:
if file.endswith((".db", ".sqlite", ".sqlite3")):
if file.endswith(('.db', '.sqlite', '.sqlite3')):
await message.reply_document(
document="/root/" + name + "/" + file,
caption="<code>Bot Database <b>" + name + "</b></code>",
document='/root/' + name + '/' + file,
caption='<code>Bot Database <b>' + name + '</b></code>',
parse_mode=enums.ParseMode.HTML,
)
return await message.delete()
folder = listdir("/root/" + name + "/assets")
folder = listdir('/root/' + name + '/assets')
for file in folder:
if file.endswith((".db", ".sqlite", ".sqlite3")):
if file.endswith(('.db', '.sqlite', '.sqlite3')):
await message.reply_document(
document="/root/" + name + "/assets/" + file,
caption="<code>Bot Database <b>" + name + "</b></code>",
document='/root/' + name + '/assets/' + file,
caption='<code>Bot Database <b>' + name + '</b></code>',
parse_mode=enums.ParseMode.HTML,
)
return await message.delete()
await message.edit("[😇] Database not found.")
await message.edit('[😇] Database not found.')
except Exception as ex:
await message.edit_text(
"Failed to back up the database!\n\n" f"{format_exc(ex)}",
f'Failed to back up the database!\n\n{format_exc(ex)}',
parse_mode=enums.ParseMode.HTML,
)
modules_help["autobackup"] = {
"lback [name]*": "<b>Backup database from folder</b>",
"lbackall": "<b>Backup all databases</b>",
modules_help['autobackup'] = {
'lback [name]*': '<b>Backup database from folder</b>',
'lbackall': '<b>Backup all databases</b>',
}