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:
+15
-14
@@ -1,11 +1,12 @@
|
||||
from pyrogram import Client, filters, enums
|
||||
from io import BytesIO
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from pyrogram import Client, enums, filters
|
||||
from pyrogram.types import Message
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from utils.misc import modules_help, prefix
|
||||
from utils.scripts import format_exc
|
||||
from aiohttp import ClientSession
|
||||
from io import BytesIO
|
||||
|
||||
session = ClientSession()
|
||||
|
||||
@@ -25,8 +26,10 @@ class Post:
|
||||
if self.large_file_url
|
||||
else (
|
||||
self.source
|
||||
if self.source and "pximg" not in self.source
|
||||
else await self.pximg if self.source else None
|
||||
if self.source and 'pximg' not in self.source
|
||||
else await self.pximg
|
||||
if self.source
|
||||
else None
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -41,16 +44,14 @@ class Post:
|
||||
|
||||
|
||||
async def random():
|
||||
async with session.get(
|
||||
url="https://danbooru.donmai.us/posts/random.json"
|
||||
) as response:
|
||||
return Post(await response.json(encoding="utf-8"), session)
|
||||
async with session.get(url='https://danbooru.donmai.us/posts/random.json') as response:
|
||||
return Post(await response.json(encoding='utf-8'), session)
|
||||
|
||||
|
||||
@Client.on_message(filters.command(["arnd", "arandom"], prefix) & filters.me)
|
||||
@Client.on_message(filters.command(['arnd', 'arandom'], prefix) & filters.me)
|
||||
async def anime_handler(client: Client, message: Message):
|
||||
try:
|
||||
await message.edit("<b>Searching art</b>", parse_mode=enums.ParseMode.HTML)
|
||||
await message.edit('<b>Searching art</b>', parse_mode=enums.ParseMode.HTML)
|
||||
ra = await random()
|
||||
img = await ra.image
|
||||
await message.reply_photo(
|
||||
@@ -63,7 +64,7 @@ async def anime_handler(client: Client, message: Message):
|
||||
await message.edit(format_exc(e), parse_mode=enums.ParseMode.HTML)
|
||||
|
||||
|
||||
modules_help["anime"] = {
|
||||
"arnd": "Random anime art (May get caught 18+)",
|
||||
"arandom": "Random anime art (May get caught 18+)",
|
||||
modules_help['anime'] = {
|
||||
'arnd': 'Random anime art (May get caught 18+)',
|
||||
'arandom': 'Random anime art (May get caught 18+)',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user