Add doc in toimage

This commit is contained in:
yasirarism 2023-02-18 19:14:35 +07:00 committed by GitHub
parent 867e4f761f
commit 850d06f1b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,7 @@ import os
import time import time
import asyncio import asyncio
import traceback import traceback
from PIL import Image
from datetime import datetime from datetime import datetime
from logging import getLogger from logging import getLogger
from urllib.parse import quote from urllib.parse import quote
@ -237,12 +238,13 @@ async def topho(client, message):
return await message.reply_text("Reply ke sticker untuk mengubah ke foto") return await message.reply_text("Reply ke sticker untuk mengubah ke foto")
if message.reply_to_message.sticker.is_animated: if message.reply_to_message.sticker.is_animated:
return await message.reply_text("Ini sticker animasi, command ini hanya untuk sticker biasa.") return await message.reply_text("Ini sticker animasi, command ini hanya untuk sticker biasa.")
photo = await client.download_media( photo = await message.reply_to_message.download()
message.reply_to_message.sticker.file_id, im = Image.open(photo).convert("RGB")
f"tostick_{message.from_user.id}.jpg", filename = f"toimg_{message.from_user.id}.png"
) im.save(filename, "png")
await asyncio.gather(*[message.reply_document(photo), message.reply_photo(photo, caption=f"Sticker -> Image\n@{client.me.username}")]) await asyncio.gather(*[message.reply_document(filename), message.reply_photo(filename, caption=f"Sticker -> Image\n@{client.me.username}")])
os.remove(photo) os.remove(photo)
os.remove(filename)
except Exception as e: except Exception as e:
await message.reply_text(str(e)) await message.reply_text(str(e))