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:
@@ -2,15 +2,14 @@ import asyncio
|
||||
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Message
|
||||
|
||||
from utils.misc import modules_help, prefix
|
||||
|
||||
|
||||
@Client.on_message(filters.command("calc", prefix) & filters.me)
|
||||
@Client.on_message(filters.command('calc', prefix) & filters.me)
|
||||
async def calc(_, message: Message):
|
||||
if len(message.command) <= 1:
|
||||
return
|
||||
args = " ".join(message.command[1:])
|
||||
args = ' '.join(message.command[1:])
|
||||
try:
|
||||
result = str(eval(args))
|
||||
|
||||
@@ -19,28 +18,24 @@ async def calc(_, message: Message):
|
||||
for x in range(0, len(result), 4096):
|
||||
if i == 0:
|
||||
await message.edit(
|
||||
f"<i>{args}</i><b>=</b><code>{result[x:x + 4000]}</code>",
|
||||
parse_mode="HTML",
|
||||
f'<i>{args}</i><b>=</b><code>{result[x : x + 4000]}</code>',
|
||||
parse_mode='HTML',
|
||||
)
|
||||
else:
|
||||
await message.reply(
|
||||
f"<code>{result[x:x + 4096]}</code>", parse_mode="HTML"
|
||||
)
|
||||
await message.reply(f'<code>{result[x : x + 4096]}</code>', parse_mode='HTML')
|
||||
i += 1
|
||||
await asyncio.sleep(0.18)
|
||||
else:
|
||||
await message.edit(
|
||||
f"<i>{args}</i><b>=</b><code>{result}</code>", parse_mode="HTML"
|
||||
)
|
||||
await message.edit(f'<i>{args}</i><b>=</b><code>{result}</code>', parse_mode='HTML')
|
||||
except Exception as e:
|
||||
await message.edit(f"<i>{args}=</i><b>=</b><code>{e}</code>", parse_mode="HTML")
|
||||
await message.edit(f'<i>{args}=</i><b>=</b><code>{e}</code>', parse_mode='HTML')
|
||||
|
||||
|
||||
modules_help["calculator"] = {
|
||||
"calc [expression]*": "solve a math problem\n"
|
||||
"+ – addition\n"
|
||||
"– – subtraction\n"
|
||||
"* – multiplication\n"
|
||||
"/ – division\n"
|
||||
"** – degree"
|
||||
modules_help['calculator'] = {
|
||||
'calc [expression]*': 'solve a math problem\n'
|
||||
'+ – addition\n'
|
||||
'– – subtraction\n'
|
||||
'* – multiplication\n'
|
||||
'/ – division\n'
|
||||
'** – degree'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user