Add nulis cmd

This commit is contained in:
yasirarism 2023-06-12 05:52:08 +00:00 committed by GitHub
parent 5a3bdeb531
commit 7d00852e89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 7 deletions

BIN
assets/assfont.ttf Normal file

Binary file not shown.

BIN
assets/kertas.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -42,7 +42,7 @@ You can use markdown or html to save text too.
"""
@app.on_message(filters.command("addfilter") & ~filters.private)
@app.on_message(filters.command(["addfilter", "filter"]) & ~filters.private)
@adminsOnly("can_change_info")
@ratelimiter
async def save_filters(_, m):
@ -77,7 +77,7 @@ async def get_filterss(_, m):
await m.reply_msg(msg)
@app.on_message(filters.command("stopfilter") & ~filters.private)
@app.on_message(filters.command(["stop", "stopfilter"]) & ~filters.private)
@adminsOnly("can_change_info")
@ratelimiter
async def del_filter(_, m):

View file

@ -45,6 +45,7 @@ __MODULE__ = "MediaExtract"
__HELP__ = """
/extractmedia [URL] - Extract subtitle or audio from video using link. (Not support TG File to reduce bandwith usage.)
/converttosrt [Reply to .ass or .vtt TG File] - Convert from .ass or .vtt to srt
/converttoass [Reply to .srt or .vtt TG File] - Convert from .srt or .vtt to srt
"""

View file

@ -42,6 +42,8 @@ __HELP__ = """
/readqr [reply to photo] - Read QR Code From Photo.
/createqr [text] - Convert Text to QR Code.
/anime [query] - Search title in myanimelist.
/info - Get info user with Pic and full description if user set profile picture.
/id - Get simple user ID.
"""
@ -252,7 +254,7 @@ async def topho(client, message):
@app.on_message(filters.command(["id"], COMMAND_HANDLER))
@ratelimiter
async def showid(client, message):
chat_type = message.chat.type
chat_type = message.chat.type.value
if chat_type == "private":
user_id = message.chat.id
first = message.from_user.first_name

View file

@ -36,15 +36,15 @@ from misskaty.helper.functions import extract_text_and_keyb
__MODULE__ = "Notes"
__HELP__ = """/notes To Get All The Notes In The Chat.
/addnote [NOTE_NAME] To Save A Note (Can be a sticker or text).
(/save, /addnote) [NOTE_NAME] To Save A Note (Can be a sticker or text).
#NOTE_NAME To Get A Note.
/delnote [NOTE_NAME] To Delete A Note.
(/clear, /delnote) [NOTE_NAME] To Delete A Note.
"""
@app.on_message(filters.command("addnote") & ~filters.private)
@app.on_message(filters.command(["addnote", "save"]) & ~filters.private)
@adminsOnly("can_change_info")
@ratelimiter
async def save_notee(_, message):
@ -113,7 +113,7 @@ async def get_one_note(_, message):
await message.reply_sticker(_note["data"])
@app.on_message(filters.command("delnote") & ~filters.private)
@app.on_message(filters.command(["delnote", "clear"]) & ~filters.private)
@adminsOnly("can_change_info")
@ratelimiter
async def del_note(_, message):

53
misskaty/plugins/nulis.py Normal file
View file

@ -0,0 +1,53 @@
from misskaty import app
from misskaty.vars import COMMAND_HANDLER
from PIL import Image, ImageFont, ImageDraw
__MODULE__ = "nulis"
__HELP__ = f"""
Command: <code>{cmd}nulis</code> [reply to msg or after cmd]
Desc: For those of you who are lazy to write.
"""
def text_set(text):
lines = []
if len(text) <= 55:
lines.append(text)
else:
all_lines = text.split("\n")
for line in all_lines:
if len(line) <= 55:
lines.append(line)
else:
k = len(line) // 55
lines.extend(line[((z - 1) * 55) : (z * 55)] for z in range(1, k + 2))
return lines[:25]
@app.on_message(filters.command(["nulis"], COMMAND_HANDLER))
async def handwrite(client, message):
if message.reply_to_message and message.reply_to_message.text:
naya = message.reply_to_message.text
elif message.command > 1:
naya = message.text.split(None, 1)[1]
else:
return await message.reply("Please reply to message or write after command to use Nulis CMD.")
nan = await message.reply_msg("Processing...")
try:
img = Image.open("assets/kertas.jpg")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("assets/assfont.ttf", 30)
x, y = 150, 140
lines = text_set(naya)
line_height = font.getsize("hg")[1]
for line in lines:
draw.text((x, y), line, fill=(1, 22, 55), font=font)
y = y + line_height - 5
file = f"nulis_{message.from_user.id}.jpg"
img.save(file)
if os.path.exists(file):
await message.reply_photo(
photo=file, caption=f"<b>Written By :</b> {client.me.mention}"
)
os.remove(file)
await nan.delete()
except Exception as e:
return await message.reply(e)