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:
+10
-16
@@ -2,21 +2,19 @@
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Message
|
||||
|
||||
from utils.scripts import format_exc, import_library
|
||||
from utils.misc import modules_help, prefix
|
||||
from utils.scripts import format_exc, import_library
|
||||
|
||||
import_library("lxml_html_clean")
|
||||
import_library("newspaper", "newspaper3k")
|
||||
nltk = import_library("nltk")
|
||||
import_library('lxml_html_clean')
|
||||
import_library('newspaper', 'newspaper3k')
|
||||
nltk = import_library('nltk')
|
||||
from newspaper import Article
|
||||
from newspaper.article import ArticleException
|
||||
|
||||
|
||||
nltk.download("all")
|
||||
nltk.download('all')
|
||||
|
||||
|
||||
@Client.on_message(filters.command("summary", prefix) & filters.me)
|
||||
@Client.on_message(filters.command('summary', prefix) & filters.me)
|
||||
async def summarize_article(_, message: Message):
|
||||
"""
|
||||
Summarize an article from a given URL.
|
||||
@@ -32,7 +30,7 @@ async def summarize_article(_, message: Message):
|
||||
url = message.text.split(maxsplit=1)[1] if len(message.text.split()) > 1 else None
|
||||
|
||||
if not url:
|
||||
await message.edit_text("Please provide a valid URL after the command.")
|
||||
await message.edit_text('Please provide a valid URL after the command.')
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -51,14 +49,10 @@ async def summarize_article(_, message: Message):
|
||||
"""
|
||||
await message.edit_text(response)
|
||||
except ArticleException:
|
||||
return await message.edit_text(
|
||||
"Unable to extract information from the provided URL."
|
||||
)
|
||||
return await message.edit_text('Unable to extract information from the provided URL.')
|
||||
|
||||
except Exception as e:
|
||||
return await message.edit_text(f"An error occurred: {format_exc(e)}")
|
||||
return await message.edit_text(f'An error occurred: {format_exc(e)}')
|
||||
|
||||
|
||||
modules_help["summary"] = {
|
||||
"summary [url]": "Reply with article links, getting summary of articles"
|
||||
}
|
||||
modules_help['summary'] = {'summary [url]': 'Reply with article links, getting summary of articles'}
|
||||
|
||||
Reference in New Issue
Block a user