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:
+9
-10
@@ -18,35 +18,34 @@
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.errors import YouBlockedUser
|
||||
from pyrogram.types import Message
|
||||
|
||||
from utils.conv import Conversation
|
||||
from utils.misc import modules_help, prefix
|
||||
from utils.scripts import format_exc
|
||||
|
||||
|
||||
@Client.on_message(filters.command("sgb", prefix) & filters.me)
|
||||
@Client.on_message(filters.command('sgb', prefix) & filters.me)
|
||||
async def sg(client: Client, message: Message):
|
||||
if message.reply_to_message and message.reply_to_message.from_user:
|
||||
user_id = message.reply_to_message.from_user.id
|
||||
else:
|
||||
await message.edit(f"<b>Usage: </b><code>{prefix}sgb [id]</code>")
|
||||
await message.edit(f'<b>Usage: </b><code>{prefix}sgb [id]</code>')
|
||||
return
|
||||
try:
|
||||
await message.edit("<code>Processing please wait</code>")
|
||||
bot_username = "@SangMata_beta_bot"
|
||||
await message.edit('<code>Processing please wait</code>')
|
||||
bot_username = '@SangMata_beta_bot'
|
||||
async with Conversation(client, bot_username, timeout=15) as conv:
|
||||
await conv.send_message(str(user_id))
|
||||
response = await conv.get_response(timeout=10)
|
||||
if "you have used up your quota" in response.text:
|
||||
if 'you have used up your quota' in response.text:
|
||||
await message.edit(response.text.splitlines()[0])
|
||||
return
|
||||
return await message.edit(response.text)
|
||||
except YouBlockedUser:
|
||||
await message.edit("<i>Please unblock @SangMata_beta_bot first.</i>")
|
||||
await message.edit('<i>Please unblock @SangMata_beta_bot first.</i>')
|
||||
except TimeoutError:
|
||||
await message.edit("<i>No response from bot within the timeout period.</i>")
|
||||
await message.edit('<i>No response from bot within the timeout period.</i>')
|
||||
except Exception as e:
|
||||
await message.edit(f"<i>Error: {format_exc(e)}</i>")
|
||||
await message.edit(f'<i>Error: {format_exc(e)}</i>')
|
||||
|
||||
|
||||
modules_help["sangmata"] = {"sgb": "reply to any user"}
|
||||
modules_help['sangmata'] = {'sgb': 'reply to any user'}
|
||||
|
||||
Reference in New Issue
Block a user