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:
+12
-19
@@ -17,26 +17,23 @@
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Message
|
||||
from pyrogram.types.user_and_chats.user import Link
|
||||
|
||||
from utils.misc import modules_help, prefix
|
||||
|
||||
|
||||
def custom_mention(user, custom_text):
|
||||
return Link(
|
||||
f"tg://user?id={user.id}",
|
||||
f'tg://user?id={user.id}',
|
||||
custom_text,
|
||||
user._client.parse_mode,
|
||||
)
|
||||
|
||||
|
||||
@Client.on_message(filters.command("mention", prefix) & filters.me)
|
||||
@Client.on_message(filters.command('mention', prefix) & filters.me)
|
||||
async def example_edit(client: Client, message: Message):
|
||||
chat_id = message.chat.id
|
||||
if message.reply_to_message and not len(message.text.split()) > 1:
|
||||
user = message.reply_to_message.from_user
|
||||
custom_text = (
|
||||
message.text.split(maxsplit=1)[1] if len(message.text.split()) > 1 else None
|
||||
)
|
||||
custom_text = message.text.split(maxsplit=1)[1] if len(message.text.split()) > 1 else None
|
||||
if custom_text:
|
||||
await message.edit(custom_mention(user, custom_text))
|
||||
else:
|
||||
@@ -46,27 +43,23 @@ async def example_edit(client: Client, message: Message):
|
||||
if len(message.text.split()) > 1:
|
||||
user_id = message.text.split()[1]
|
||||
if user_id.isdigit():
|
||||
text = (
|
||||
message.text.split(maxsplit=2)[2]
|
||||
if len(message.text.split()) > 2
|
||||
else None
|
||||
)
|
||||
text = message.text.split(maxsplit=2)[2] if len(message.text.split()) > 2 else None
|
||||
if text:
|
||||
men = Link(f"tg://user?id={user_id}", text, client.parse_mode)
|
||||
men = Link(f'tg://user?id={user_id}', text, client.parse_mode)
|
||||
else:
|
||||
men = (await client.get_users(user_id)).mention
|
||||
await message.edit(men)
|
||||
else:
|
||||
await message.edit("Invalid user_id")
|
||||
await message.edit('Invalid user_id')
|
||||
await message.delete()
|
||||
else:
|
||||
await message.edit("Reply to a message or provide a user_id")
|
||||
await message.edit('Reply to a message or provide a user_id')
|
||||
await message.delete()
|
||||
|
||||
|
||||
modules_help["mention"] = {
|
||||
"mention": "Mention the user you replied to.",
|
||||
"mention [custom_text]": "Mention the user you replied to with custom text.",
|
||||
"mention [user_id] [custom_text]": "Mention a user by their user_id with custom text.",
|
||||
"mention [user_id]": "Mention a user by their user_id.",
|
||||
modules_help['mention'] = {
|
||||
'mention': 'Mention the user you replied to.',
|
||||
'mention [custom_text]': 'Mention the user you replied to with custom text.',
|
||||
'mention [user_id] [custom_text]': 'Mention a user by their user_id with custom text.',
|
||||
'mention [user_id]': 'Mention a user by their user_id.',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user