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
+36 -44
View File
@@ -1,26 +1,26 @@
from asyncio import sleep
from pyrogram import Client, filters, enums
from pyrogram import Client, enums, filters
from pyrogram.raw import functions
from pyrogram.types import Message, InputReplyToMessage
from pyrogram.types import InputReplyToMessage, Message
from utils.misc import modules_help, prefix
from utils.scripts import format_exc
commands = {
"ftype": enums.ChatAction.TYPING,
"faudio": enums.ChatAction.UPLOAD_AUDIO,
"fvideo": enums.ChatAction.UPLOAD_VIDEO,
"fphoto": enums.ChatAction.UPLOAD_PHOTO,
"fdocument": enums.ChatAction.UPLOAD_DOCUMENT,
"flocation": enums.ChatAction.FIND_LOCATION,
"frvideo": enums.ChatAction.RECORD_VIDEO,
"frvoice": enums.ChatAction.RECORD_AUDIO,
"frvideor": enums.ChatAction.RECORD_VIDEO_NOTE,
"fvideor": enums.ChatAction.UPLOAD_VIDEO_NOTE,
"fgame": enums.ChatAction.PLAYING,
"fcontact": enums.ChatAction.CHOOSE_CONTACT,
"fstop": enums.ChatAction.CANCEL,
"fscrn": "screenshot",
'ftype': enums.ChatAction.TYPING,
'faudio': enums.ChatAction.UPLOAD_AUDIO,
'fvideo': enums.ChatAction.UPLOAD_VIDEO,
'fphoto': enums.ChatAction.UPLOAD_PHOTO,
'fdocument': enums.ChatAction.UPLOAD_DOCUMENT,
'flocation': enums.ChatAction.FIND_LOCATION,
'frvideo': enums.ChatAction.RECORD_VIDEO,
'frvoice': enums.ChatAction.RECORD_AUDIO,
'frvideor': enums.ChatAction.RECORD_VIDEO_NOTE,
'fvideor': enums.ChatAction.UPLOAD_VIDEO_NOTE,
'fgame': enums.ChatAction.PLAYING,
'fcontact': enums.ChatAction.CHOOSE_CONTACT,
'fstop': enums.ChatAction.CANCEL,
'fscrn': 'screenshot',
}
@@ -39,12 +39,10 @@ async def fakeactions_handler(client: Client, message: Message):
action = commands[cmd]
try:
if action != "screenshot":
if action != 'screenshot':
if sec and action != enums.ChatAction.CANCEL:
while sec > 0:
await client.send_chat_action(
chat_id=message.chat.id, action=action
)
await client.send_chat_action(chat_id=message.chat.id, action=action)
await sleep(1)
sec -= 1
return await client.send_chat_action(chat_id=message.chat.id, action=action)
@@ -53,36 +51,30 @@ async def fakeactions_handler(client: Client, message: Message):
await client.invoke(
functions.messages.SendScreenshotNotification(
peer=await client.resolve_peer(message.chat.id),
reply_to=InputReplyToMessage(
reply_to_message_id=message.reply_to_message.id
),
reply_to=InputReplyToMessage(reply_to_message_id=message.reply_to_message.id),
random_id=client.rnd_id(),
)
)
await sleep(0.1)
except AttributeError:
return await client.send_message(
"me", f"Error in <b>fakeactions</b>" "reply to message is required"
)
return await client.send_message('me', 'Error in <b>fakeactions</b>reply to message is required')
except Exception as e:
return await client.send_message(
"me", f"Error in <b>fakeactions</b>" f" module:\n" + format_exc(e)
)
return await client.send_message('me', 'Error in <b>fakeactions</b> module:\n' + format_exc(e))
modules_help["fakeactions"] = {
"ftype [sec]": "Typing... action",
"faudio [sec]": "Sending voice... action",
"fvideo [sec]": "Sending video... action",
"fphoto [sec]": "Sending photo... action",
"fdocument [sec]": "Sending document... action",
"flocation [sec]": "Find location... action",
"fcontact [sec]": "Sending contact... action",
"frvideo [sec]": "Recording video... action",
"frvoice [sec]": "Recording voice... action",
"frvideor [sec]": "Recording round video... action",
"fvideor [sec]": "Uploading round video... action",
"fgame [sec]": "Playing game... action",
"fstop": "Stop actions",
"fscrn [amount] [reply_to_message]*": "Make screenshot action",
modules_help['fakeactions'] = {
'ftype [sec]': 'Typing... action',
'faudio [sec]': 'Sending voice... action',
'fvideo [sec]': 'Sending video... action',
'fphoto [sec]': 'Sending photo... action',
'fdocument [sec]': 'Sending document... action',
'flocation [sec]': 'Find location... action',
'fcontact [sec]': 'Sending contact... action',
'frvideo [sec]': 'Recording video... action',
'frvoice [sec]': 'Recording voice... action',
'frvideor [sec]': 'Recording round video... action',
'fvideor [sec]': 'Uploading round video... action',
'fgame [sec]': 'Playing game... action',
'fstop': 'Stop actions',
'fscrn [amount] [reply_to_message]*': 'Make screenshot action',
}