Update memify.py

This commit is contained in:
yasirarism 2023-03-19 17:33:27 +07:00 committed by GitHub
parent 3ebaca8398
commit 2c1c7d0f15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,11 +128,14 @@ async def draw_meme_text(image_path, text):
) )
current_h += u_height + pad current_h += u_height + pad
webp_file = "memifymycatty.webp" webp_file = "misskatyfy.webp"
png_file = "misskatyfy.png"
new_size = (512, 512) new_size = (512, 512)
img.resize(new_size) img.resize(new_size)
img.save(webp_file, "WebP") img.save(webp_file, "WebP")
return webp_file img.save(png_file, "PNG")
img.close()
return webp_file, png_file
@app.on_message(filters.command(["mmf"], COMMAND_HANDLER)) @app.on_message(filters.command(["mmf"], COMMAND_HANDLER))
@ -142,10 +145,12 @@ async def memify(client, message):
if message.reply_to_message and (message.reply_to_message.sticker or message.reply_to_message.photo): if message.reply_to_message and (message.reply_to_message.sticker or message.reply_to_message.photo):
try: try:
file = await message.reply_to_message.download() file = await message.reply_to_message.download()
res = await draw_meme_text(file, message.text.split(None, 1)[1].strip()) webp, png = await draw_meme_text(file, message.text.split(None, 1)[1].strip())
await message.reply_sticker(res) await message.reply_sticker(webp)
await message.reply_document(png)
try: try:
hapus(res) hapus(webp)
hapus(png)
except: except:
pass pass
except: except: