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:
+17
-25
@@ -1,51 +1,45 @@
|
||||
from io import BytesIO
|
||||
from random import randint
|
||||
|
||||
from pyrogram import Client, filters, enums
|
||||
from pyrogram.types import Message
|
||||
|
||||
from requests import get
|
||||
from PIL import Image, ImageFont, ImageDraw
|
||||
from textwrap import wrap
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from pyrogram import Client, enums, filters
|
||||
from pyrogram.types import Message
|
||||
from requests import get
|
||||
from utils.misc import modules_help, prefix
|
||||
|
||||
|
||||
@Client.on_message(filters.command("amogus", prefix) & filters.me)
|
||||
@Client.on_message(filters.command('amogus', prefix) & filters.me)
|
||||
async def amogus(client: Client, message: Message):
|
||||
text = " ".join(message.command[1:])
|
||||
text = ' '.join(message.command[1:])
|
||||
|
||||
await message.edit(
|
||||
"<b>amgus, tun tun tun tun tun tun tun tudududn tun tun...</b>",
|
||||
'<b>amgus, tun tun tun tun tun tun tun tudududn tun tun...</b>',
|
||||
parse_mode=enums.ParseMode.HTML,
|
||||
)
|
||||
|
||||
clr = randint(1, 12)
|
||||
|
||||
url = "https://raw.githubusercontent.com/The-MoonTg-project/AmongUs/master/"
|
||||
font = ImageFont.truetype(BytesIO(get(url + "bold.ttf").content), 60)
|
||||
imposter = Image.open(BytesIO(get(f"{url}{clr}.png").content))
|
||||
url = 'https://raw.githubusercontent.com/The-MoonTg-project/AmongUs/master/'
|
||||
font = ImageFont.truetype(BytesIO(get(url + 'bold.ttf').content), 60)
|
||||
imposter = Image.open(BytesIO(get(f'{url}{clr}.png').content))
|
||||
|
||||
text_ = "\n".join(["\n".join(wrap(part, 30)) for part in text.split("\n")])
|
||||
bbox = ImageDraw.Draw(Image.new("RGB", (1, 1))).multiline_textbbox(
|
||||
(0, 0), text_, font, stroke_width=2
|
||||
)
|
||||
text_ = '\n'.join(['\n'.join(wrap(part, 30)) for part in text.split('\n')])
|
||||
bbox = ImageDraw.Draw(Image.new('RGB', (1, 1))).multiline_textbbox((0, 0), text_, font, stroke_width=2)
|
||||
# w, h = bbox[2] - bbox[0], bbox[3] - bbox[1]
|
||||
w, h = bbox[2], bbox[3]
|
||||
text = Image.new("RGBA", (w + 30, h + 30))
|
||||
ImageDraw.Draw(text).multiline_text(
|
||||
(15, 15), text_, "#FFF", font, stroke_width=2, stroke_fill="#000"
|
||||
)
|
||||
text = Image.new('RGBA', (w + 30, h + 30))
|
||||
ImageDraw.Draw(text).multiline_text((15, 15), text_, '#FFF', font, stroke_width=2, stroke_fill='#000')
|
||||
w = imposter.width + text.width + 10
|
||||
h = max(imposter.height, text.height)
|
||||
|
||||
image = Image.new("RGBA", (w, h))
|
||||
image = Image.new('RGBA', (w, h))
|
||||
image.paste(imposter, (0, h - imposter.height), imposter)
|
||||
image.paste(text, (w - text.width, 0), text)
|
||||
image.thumbnail((512, 512))
|
||||
|
||||
output = BytesIO()
|
||||
output.name = "imposter.webp"
|
||||
output.name = 'imposter.webp'
|
||||
image.save(output)
|
||||
output.seek(0)
|
||||
|
||||
@@ -53,6 +47,4 @@ async def amogus(client: Client, message: Message):
|
||||
await client.send_sticker(message.chat.id, output)
|
||||
|
||||
|
||||
modules_help["amogus"] = {
|
||||
"amogus [text]": "amgus, tun tun tun tun tun tun tun tudududn tun tun"
|
||||
}
|
||||
modules_help['amogus'] = {'amogus [text]': 'amgus, tun tun tun tun tun tun tun tudududn tun tun'}
|
||||
|
||||
Reference in New Issue
Block a user